@nodesecure/js-x-ray
Version:
JavaScript AST XRay analysis
13 lines • 404 B
JavaScript
export function makePrefixRemover(prefixes) {
return (expr) => {
if (!expr.includes(".")) {
return expr;
}
const matchedPrefix = Array.from(prefixes)
.find((globalId) => expr.startsWith(globalId));
return matchedPrefix ?
expr.slice(matchedPrefix.length + 1) :
expr;
};
}
//# sourceMappingURL=makePrefixRemover.js.map