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

Function isKeyObjectFactory

tools/eslint-rules/no-keyobject-public-accessors.js:140–162  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

138 }
139
140 function isKeyObjectFactory(node) {
141 if (node?.type === 'NewExpression' &&
142 node.callee.type === 'Identifier') {
143 return knownKeyObjectClassNames.has(node.callee.name);
144 }
145
146 if (node?.type !== 'CallExpression') return false;
147
148 if (node.callee.type === 'Identifier') {
149 return keyObjectFactoryNames.has(node.callee.name);
150 }
151
152 if (node.callee.type !== 'MemberExpression') return false;
153 const object = node.callee.object;
154 const property = getPropertyName(node.callee);
155 if (object.type === 'Identifier' &&
156 knownKeyObjectClassNames.has(object.name)) {
157 return property === 'from';
158 }
159 return object.type === 'Identifier' &&
160 namespaceNames.has(object.name) &&
161 keyObjectFactoryNames.has(property);
162 }
163
164 function isInKeyObjectBranch(name, node) {
165 for (let current = node.parent; current; current = current.parent) {

Callers 1

VariableDeclaratorFunction · 0.85

Calls 2

getPropertyNameFunction · 0.70
hasMethod · 0.65

Tested by

no test coverage detected