uni-ticket-system/node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/lib/util.js
2023-12-05 10:11:10 +08:00

28 lines
609 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.shouldTransform = shouldTransform;
function shouldTransform(path) {
const {
node
} = path;
const functionId = node.id;
if (!functionId) return false;
const name = functionId.name;
const paramNameBinding = path.scope.getOwnBinding(name);
if (paramNameBinding === undefined) {
return false;
}
if (paramNameBinding.kind !== "param") {
return false;
}
if (paramNameBinding.identifier === paramNameBinding.path.node) {
return false;
}
return name;
}
//# sourceMappingURL=util.js.map