UNPKG

@nodesecure/js-x-ray

Version:
27 lines 774 B
// Import Internal Dependencies import { SourceFile } from "../SourceFile.js"; import { extractNode } from "../utils/index.js"; // CONSTANTS const kLiteralExtractor = extractNode("Literal"); /** * @description Search for ArrayExpression AST Node (Commonly known as JS Arrays) * * @see https://github.com/estree/estree/blob/master/es5.md#arrayexpression * @example * ["foo", "bar", 1] */ function validateNode(node) { return [ node.type === "ArrayExpression" ]; } function main(node, { sourceFile }) { kLiteralExtractor((literalNode) => sourceFile.analyzeLiteral(literalNode, true), node.elements); } export default { name: "isArrayExpression", validateNode, main, breakOnMatch: false }; //# sourceMappingURL=isArrayExpression.js.map