MCPcopy Create free account
hub / github.com/rollup/plugins / getKeypath

Function getKeypath

packages/commonjs/src/ast-utils.js:56–73  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

54}
55
56export function getKeypath(node) {
57 const parts = [];
58
59 while (node.type === 'MemberExpression') {
60 if (node.computed) return null;
61
62 parts.unshift(node.property.name);
63 // eslint-disable-next-line no-param-reassign
64 node = node.object;
65 }
66
67 if (node.type !== 'Identifier') return null;
68
69 const { name } = node;
70 parts.unshift(name);
71
72 return { name, keypath: parts.join('.') };
73}
74
75export const KEY_COMPILED_ESM = '__esModule';
76

Callers 1

enterFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected