Sha256: 2e70d9a0a9681f0ca46ff8540ff5d41d44a0cf680efd647322e72d29bb291fa4

Contents?: true

Size: 743 Bytes

Versions: 7

Compression:

Stored size: 743 Bytes

Contents

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = isBinding;

var _getBindingIdentifiers = require("../retrievers/getBindingIdentifiers");

function isBinding(node, parent, grandparent) {
  if (grandparent && node.type === "Identifier" && parent.type === "ObjectProperty" && grandparent.type === "ObjectExpression") {
    return false;
  }

  const keys = _getBindingIdentifiers.default.keys[parent.type];

  if (keys) {
    for (let i = 0; i < keys.length; i++) {
      const key = keys[i];
      const val = parent[key];

      if (Array.isArray(val)) {
        if (val.indexOf(node) >= 0) return true;
      } else {
        if (val === node) return true;
      }
    }
  }

  return false;
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
disco_app-0.16.1 test/dummy/node_modules/@babel/types/lib/validators/isBinding.js
disco_app-0.15.2 test/dummy/node_modules/@babel/types/lib/validators/isBinding.js
disco_app-0.18.4 test/dummy/node_modules/@babel/types/lib/validators/isBinding.js
disco_app-0.18.1 test/dummy/node_modules/@babel/types/lib/validators/isBinding.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/@babel/types/lib/validators/isBinding.js
disco_app-0.14.0 test/dummy/node_modules/@babel/types/lib/validators/isBinding.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/@babel/types/lib/validators/isBinding.js