UNPKG

628 BJavaScriptView Raw
1"use strict";
2
3exports.__esModule = true;
4exports.default = getMembers;
5
6function getMembers(path) {
7 const members = [];
8 let nextPath = path;
9
10 while (true) {
11 if (nextPath.isMemberExpression() || nextPath.isJSXMemberExpression()) {
12 members.push({
13 path: nextPath.get('property'),
14 computed: nextPath.isMemberExpression() ? nextPath.node.computed : false
15 });
16 nextPath = path.get('object');
17 } else if (nextPath.isCallExpression()) {
18 nextPath = path.get('callee');
19 }
20
21 break;
22 }
23
24 members.push({
25 path: nextPath,
26 computed: false
27 });
28 return members.reverse();
29}
\No newline at end of file