index.js 979 B

12345678910111213141516171819202122232425262728293031323334
  1. "use strict";
  2. exports.__esModule = true;
  3. exports.default = function () {
  4. return {
  5. visitor: {
  6. FunctionExpression: {
  7. exit: function exit(path) {
  8. if (path.key !== "value" && !path.parentPath.isObjectProperty()) {
  9. var replacement = (0, _babelHelperFunctionName2.default)(path);
  10. if (replacement) path.replaceWith(replacement);
  11. }
  12. }
  13. },
  14. ObjectProperty: function ObjectProperty(path) {
  15. var value = path.get("value");
  16. if (value.isFunction()) {
  17. var newNode = (0, _babelHelperFunctionName2.default)(value);
  18. if (newNode) value.replaceWith(newNode);
  19. }
  20. }
  21. }
  22. };
  23. };
  24. var _babelHelperFunctionName = require("babel-helper-function-name");
  25. var _babelHelperFunctionName2 = _interopRequireDefault(_babelHelperFunctionName);
  26. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  27. module.exports = exports["default"];