Last change
on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
743 bytes
|
Line | |
---|
1 | "use strict";
|
---|
2 |
|
---|
3 | Object.defineProperty(exports, "__esModule", {
|
---|
4 | value: true
|
---|
5 | });
|
---|
6 | exports.default = isBinding;
|
---|
7 |
|
---|
8 | var _getBindingIdentifiers = require("../retrievers/getBindingIdentifiers");
|
---|
9 |
|
---|
10 | function isBinding(node, parent, grandparent) {
|
---|
11 | if (grandparent && node.type === "Identifier" && parent.type === "ObjectProperty" && grandparent.type === "ObjectExpression") {
|
---|
12 | return false;
|
---|
13 | }
|
---|
14 |
|
---|
15 | const keys = _getBindingIdentifiers.default.keys[parent.type];
|
---|
16 |
|
---|
17 | if (keys) {
|
---|
18 | for (let i = 0; i < keys.length; i++) {
|
---|
19 | const key = keys[i];
|
---|
20 | const val = parent[key];
|
---|
21 |
|
---|
22 | if (Array.isArray(val)) {
|
---|
23 | if (val.indexOf(node) >= 0) return true;
|
---|
24 | } else {
|
---|
25 | if (val === node) return true;
|
---|
26 | }
|
---|
27 | }
|
---|
28 | }
|
---|
29 |
|
---|
30 | return false;
|
---|
31 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.