index.js 1.1 KB

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