Sha256: 5eef20a5133ec768d0b2ec39d540138bbf7289ddd251155fef8c6a2ef46e825d

Contents?: true

Size: 1.99 KB

Versions: 106

Compression:

Stored size: 1.99 KB

Contents

{"version":3,"names":["_getBindingIdentifiers","require","isBinding","node","parent","grandparent","type","keys","getBindingIdentifiers","i","length","key","val","Array","isArray","includes"],"sources":["../../src/validators/isBinding.ts"],"sourcesContent":["import getBindingIdentifiers from \"../retrievers/getBindingIdentifiers.ts\";\nimport type * as t from \"../index.ts\";\n/**\n * Check if the input `node` is a binding identifier.\n */\nexport default function isBinding(\n  node: t.Node,\n  parent: t.Node,\n  grandparent?: t.Node,\n): boolean {\n  if (\n    grandparent &&\n    node.type === \"Identifier\" &&\n    parent.type === \"ObjectProperty\" &&\n    grandparent.type === \"ObjectExpression\"\n  ) {\n    // We need to special-case this, because getBindingIdentifiers\n    // has an ObjectProperty->value entry for destructuring patterns.\n    return false;\n  }\n\n  const keys = getBindingIdentifiers.keys[parent.type];\n  if (keys) {\n    for (let i = 0; i < keys.length; i++) {\n      const key = keys[i];\n      const val =\n        // @ts-expect-error key must present in parent\n        parent[key];\n      if (Array.isArray(val)) {\n        if (val.includes(node)) return true;\n      } else {\n        if (val === node) return true;\n      }\n    }\n  }\n\n  return false;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AAKe,SAASC,SAASA,CAC/BC,IAAY,EACZC,MAAc,EACdC,WAAoB,EACX;EACT,IACEA,WAAW,IACXF,IAAI,CAACG,IAAI,KAAK,YAAY,IAC1BF,MAAM,CAACE,IAAI,KAAK,gBAAgB,IAChCD,WAAW,CAACC,IAAI,KAAK,kBAAkB,EACvC;IAGA,OAAO,KAAK;EACd;EAEA,MAAMC,IAAI,GAAGC,8BAAqB,CAACD,IAAI,CAACH,MAAM,CAACE,IAAI,CAAC;EACpD,IAAIC,IAAI,EAAE;IACR,KAAK,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,IAAI,CAACG,MAAM,EAAED,CAAC,EAAE,EAAE;MACpC,MAAME,GAAG,GAAGJ,IAAI,CAACE,CAAC,CAAC;MACnB,MAAMG,GAAG,GAEPR,MAAM,CAACO,GAAG,CAAC;MACb,IAAIE,KAAK,CAACC,OAAO,CAACF,GAAG,CAAC,EAAE;QACtB,IAAIA,GAAG,CAACG,QAAQ,CAACZ,IAAI,CAAC,EAAE,OAAO,IAAI;MACrC,CAAC,MAAM;QACL,IAAIS,GAAG,KAAKT,IAAI,EAAE,OAAO,IAAI;MAC/B;IACF;EACF;EAEA,OAAO,KAAK;AACd","ignoreList":[]}

Version data entries

106 entries across 7 versions & 1 rubygems

Version Path
immosquare-cleaner-0.1.46 node_modules/@babel/plugin-transform-react-jsx/node_modules/@babel/types/lib/validators/isBinding.js.map
immosquare-cleaner-0.1.46 node_modules/@babel/plugin-transform-object-super/node_modules/@babel/helper-replace-supers/node_modules/@babel/traverse/node_modules/@babel/types/lib/validators/isBinding.js.map
immosquare-cleaner-0.1.46 node_modules/@babel/plugin-transform-object-super/node_modules/@babel/helper-replace-supers/node_modules/@babel/helper-member-expression-to-functions/node_modules/@babel/types/lib/validators/isBinding.js.map
immosquare-cleaner-0.1.46 node_modules/@babel/plugin-transform-modules-systemjs/node_modules/@babel/traverse/node_modules/@babel/types/lib/validators/isBinding.js.map
immosquare-cleaner-0.1.46 node_modules/@babel/plugin-transform-function-name/node_modules/@babel/traverse/node_modules/@babel/types/lib/validators/isBinding.js.map
immosquare-cleaner-0.1.46 node_modules/@babel/plugin-transform-computed-properties/node_modules/@babel/template/node_modules/@babel/types/lib/validators/isBinding.js.map
immosquare-cleaner-0.1.46 node_modules/@babel/plugin-transform-classes/node_modules/@babel/traverse/node_modules/@babel/types/lib/validators/isBinding.js.map
immosquare-cleaner-0.1.46 node_modules/@babel/plugin-transform-classes/node_modules/@babel/helper-replace-supers/node_modules/@babel/helper-member-expression-to-functions/node_modules/@babel/types/lib/validators/isBinding.js.map
immosquare-cleaner-0.1.46 node_modules/@babel/plugin-transform-async-generator-functions/node_modules/@babel/traverse/node_modules/@babel/types/lib/validators/isBinding.js.map
immosquare-cleaner-0.1.46 node_modules/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/node_modules/@babel/traverse/node_modules/@babel/types/lib/validators/isBinding.js.map
immosquare-cleaner-0.1.46 node_modules/@babel/helper-remap-async-to-generator/node_modules/@babel/traverse/node_modules/@babel/types/lib/validators/isBinding.js.map
immosquare-cleaner-0.1.46 node_modules/@babel/helper-builder-binary-assignment-operator-visitor/node_modules/@babel/types/lib/validators/isBinding.js.map
immosquare-cleaner-0.1.45 node_modules/@babel/helper-remap-async-to-generator/node_modules/@babel/traverse/node_modules/@babel/types/lib/validators/isBinding.js.map
immosquare-cleaner-0.1.45 node_modules/@babel/preset-modules/node_modules/@babel/types/lib/validators/isBinding.js.map
immosquare-cleaner-0.1.45 node_modules/@babel/plugin-transform-react-jsx/node_modules/@babel/types/lib/validators/isBinding.js.map
immosquare-cleaner-0.1.45 node_modules/@babel/plugin-transform-object-super/node_modules/@babel/helper-replace-supers/node_modules/@babel/traverse/node_modules/@babel/types/lib/validators/isBinding.js.map
immosquare-cleaner-0.1.45 node_modules/@babel/plugin-transform-object-super/node_modules/@babel/helper-replace-supers/node_modules/@babel/helper-member-expression-to-functions/node_modules/@babel/types/lib/validators/isBinding.js.map
immosquare-cleaner-0.1.45 node_modules/@babel/plugin-transform-modules-systemjs/node_modules/@babel/traverse/node_modules/@babel/types/lib/validators/isBinding.js.map
immosquare-cleaner-0.1.45 node_modules/@babel/plugin-transform-function-name/node_modules/@babel/traverse/node_modules/@babel/types/lib/validators/isBinding.js.map
immosquare-cleaner-0.1.45 node_modules/@babel/plugin-transform-computed-properties/node_modules/@babel/template/node_modules/@babel/types/lib/validators/isBinding.js.map