Sha256: 66086d0d33c5d57eae5bae0826d33da3e68470f817376d925c78d62cd14e8304

Contents?: true

Size: 1.65 KB

Versions: 55

Compression:

Stored size: 1.65 KB

Contents

{"version":3,"names":["_index","require","traverseFast","node","enter","opts","keys","VISITOR_KEYS","type","key","subNode","Array","isArray"],"sources":["../../src/traverse/traverseFast.ts"],"sourcesContent":["import { VISITOR_KEYS } from \"../definitions/index.ts\";\nimport type * as t from \"../index.ts\";\n\n/**\n * A prefix AST traversal implementation meant for simple searching\n * and processing.\n */\nexport default function traverseFast<Options = {}>(\n  node: t.Node | null | undefined,\n  enter: (node: t.Node, opts?: Options) => void,\n  opts?: Options,\n): void {\n  if (!node) return;\n\n  const keys = VISITOR_KEYS[node.type];\n  if (!keys) return;\n\n  opts = opts || ({} as Options);\n  enter(node, opts);\n\n  for (const key of keys) {\n    const subNode: t.Node | undefined | null =\n      // @ts-expect-error key must present in node\n      node[key];\n\n    if (Array.isArray(subNode)) {\n      for (const node of subNode) {\n        traverseFast(node, enter, opts);\n      }\n    } else {\n      traverseFast(subNode, enter, opts);\n    }\n  }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAOe,SAASC,YAAYA,CAClCC,IAA+B,EAC/BC,KAA6C,EAC7CC,IAAc,EACR;EACN,IAAI,CAACF,IAAI,EAAE;EAEX,MAAMG,IAAI,GAAGC,mBAAY,CAACJ,IAAI,CAACK,IAAI,CAAC;EACpC,IAAI,CAACF,IAAI,EAAE;EAEXD,IAAI,GAAGA,IAAI,IAAK,CAAC,CAAa;EAC9BD,KAAK,CAACD,IAAI,EAAEE,IAAI,CAAC;EAEjB,KAAK,MAAMI,GAAG,IAAIH,IAAI,EAAE;IACtB,MAAMI,OAAkC,GAEtCP,IAAI,CAACM,GAAG,CAAC;IAEX,IAAIE,KAAK,CAACC,OAAO,CAACF,OAAO,CAAC,EAAE;MAC1B,KAAK,MAAMP,IAAI,IAAIO,OAAO,EAAE;QAC1BR,YAAY,CAACC,IAAI,EAAEC,KAAK,EAAEC,IAAI,CAAC;MACjC;IACF,CAAC,MAAM;MACLH,YAAY,CAACQ,OAAO,EAAEN,KAAK,EAAEC,IAAI,CAAC;IACpC;EACF;AACF","ignoreList":[]}

Version data entries

55 entries across 15 versions & 2 rubygems

Version Path
immosquare-cleaner-0.1.51 node_modules/@babel/helper-annotate-as-pure/node_modules/@babel/types/lib/traverse/traverseFast.js.map
immosquare-cleaner-0.1.51 node_modules/@babel/helper-module-imports/node_modules/@babel/types/lib/traverse/traverseFast.js.map
immosquare-cleaner-0.1.51 node_modules/@babel/helper-function-name/node_modules/@babel/types/lib/traverse/traverseFast.js.map
immosquare-cleaner-0.1.51 node_modules/@babel/helper-split-export-declaration/node_modules/@babel/types/lib/traverse/traverseFast.js.map
immosquare-cleaner-0.1.51 node_modules/@babel/helper-environment-visitor/node_modules/@babel/types/lib/traverse/traverseFast.js.map
immosquare-cleaner-0.1.51 node_modules/@babel/helper-optimise-call-expression/node_modules/@babel/types/lib/traverse/traverseFast.js.map
immosquare-cleaner-0.1.51 node_modules/@babel/helper-skip-transparent-expression-wrappers/node_modules/@babel/types/lib/traverse/traverseFast.js.map
immosquare-cleaner-0.1.51 node_modules/jscodeshift/node_modules/@babel/core/node_modules/@babel/types/lib/traverse/traverseFast.js.map
immosquare-cleaner-0.1.51 node_modules/@babel/helper-member-expression-to-functions/node_modules/@babel/types/lib/traverse/traverseFast.js.map
immosquare-cleaner-0.1.51 node_modules/@babel/helper-hoist-variables/node_modules/@babel/types/lib/traverse/traverseFast.js.map
immosquare-cleaner-0.1.51 node_modules/@babel/helper-simple-access/node_modules/@babel/types/lib/traverse/traverseFast.js.map
immosquare-cleaner-0.1.50 node_modules/@babel/helper-optimise-call-expression/node_modules/@babel/types/lib/traverse/traverseFast.js.map
immosquare-cleaner-0.1.50 node_modules/@babel/helper-hoist-variables/node_modules/@babel/types/lib/traverse/traverseFast.js.map
immosquare-cleaner-0.1.50 node_modules/@babel/helper-module-imports/node_modules/@babel/types/lib/traverse/traverseFast.js.map
immosquare-cleaner-0.1.50 node_modules/@babel/helper-member-expression-to-functions/node_modules/@babel/types/lib/traverse/traverseFast.js.map
immosquare-cleaner-0.1.50 node_modules/@babel/helper-simple-access/node_modules/@babel/types/lib/traverse/traverseFast.js.map
immosquare-cleaner-0.1.50 node_modules/@babel/helper-environment-visitor/node_modules/@babel/types/lib/traverse/traverseFast.js.map
immosquare-cleaner-0.1.50 node_modules/jscodeshift/node_modules/@babel/core/node_modules/@babel/types/lib/traverse/traverseFast.js.map
immosquare-cleaner-0.1.50 node_modules/@babel/helper-split-export-declaration/node_modules/@babel/types/lib/traverse/traverseFast.js.map
immosquare-cleaner-0.1.50 node_modules/@babel/helper-function-name/node_modules/@babel/types/lib/traverse/traverseFast.js.map