util.js 609 B

123456789101112131415161718192021222324252627
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.shouldTransform = shouldTransform;
  6. function shouldTransform(path) {
  7. const {
  8. node
  9. } = path;
  10. const functionId = node.id;
  11. if (!functionId) return false;
  12. const name = functionId.name;
  13. const paramNameBinding = path.scope.getOwnBinding(name);
  14. if (paramNameBinding === undefined) {
  15. return false;
  16. }
  17. if (paramNameBinding.kind !== "param") {
  18. return false;
  19. }
  20. if (paramNameBinding.identifier === paramNameBinding.path.node) {
  21. return false;
  22. }
  23. return name;
  24. }
  25. //# sourceMappingURL=util.js.map