MCPcopy Index your code
hub / github.com/nodejs/node / getDestructuringAssignmentParent

Function getDestructuringAssignmentParent

tools/eslint-rules/prefer-primordials.js:49–61  ·  view source on GitHub ↗

* Get identifier of object spread assignment * @returns {null | object}

(scope, node)

Source from the content-addressed store, hash-verified

47 * @returns {null | object}
48 */
49function getDestructuringAssignmentParent(scope, node) {
50 const declaration = scope.set.get(node.name);
51 if (
52 !declaration ||
53 !declaration.defs ||
54 declaration.defs.length === 0 ||
55 declaration.defs[0].type !== 'Variable' ||
56 !declaration.defs[0].node.init
57 ) {
58 return null;
59 }
60 return declaration.defs[0].node.init;
61}
62
63const parentSelectors = [
64 // We want to select identifiers that refer to other references, not the ones

Callers 1

[identifierSelector]Function · 0.85

Calls 1

getMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…