1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | exports.default = function (t) {
|
16 | return function (path) {
|
17 | var namedNode = void 0;
|
18 |
|
19 | path.find(function (path) {
|
20 |
|
21 | if (path.isAssignmentExpression()) {
|
22 | namedNode = path.node.left;
|
23 |
|
24 | } else if (path.isObjectProperty()) {
|
25 | namedNode = path.node.key;
|
26 |
|
27 | } else if (path.isClassProperty()) {
|
28 | namedNode = path.node.key;
|
29 |
|
30 | } else if (path.isVariableDeclarator()) {
|
31 | namedNode = path.node.id;
|
32 | } else if (path.isStatement()) {
|
33 |
|
34 | return true;
|
35 | }
|
36 |
|
37 |
|
38 | if (namedNode) return true;
|
39 | });
|
40 |
|
41 |
|
42 | if (t.isMemberExpression(namedNode)) {
|
43 | namedNode = namedNode.property;
|
44 | }
|
45 |
|
46 |
|
47 | return t.isIdentifier(namedNode) ? namedNode.name : undefined;
|
48 | };
|
49 | }; |
\ | No newline at end of file |