eslint-codemod-utils
Version:
A collection of AST helper functions for more complex ESLint rule fixes.
19 lines (18 loc) • 618 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.node = void 0;
const constants_1 = require("../constants");
/**
* Internally focused function to help resolve / parse the AST. It hands off to the
* `typeToHelperLookup` map to apply the correct transformation.
*
* In theory this function can be applied to any valid esprima node blindly and
* it will correctly resolve to an `eslint-codemod-utils` stringable node.
*
* @internal
*/
const node = (estNode) => {
// @ts-expect-error
return constants_1.typeToHelperLookup[estNode.type](estNode);
};
exports.node = node;