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

Function registerRequire

tools/eslint-rules/no-keyobject-cryptokey-instanceof.js:54–75  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

52 const cryptoKeyConstructorNames = new Set(['CryptoKey']);
53
54 function registerRequire(node) {
55 if (!isKeyModuleRequire(node.init)) return;
56
57 if (node.id.type === 'Identifier') {
58 namespaceNames.add(node.id.name);
59 return;
60 }
61
62 if (node.id.type !== 'ObjectPattern') return;
63
64 for (const property of node.id.properties) {
65 if (property.type !== 'Property') continue;
66 const keyName = property.key.name ?? property.key.value;
67 if (property.value.type !== 'Identifier') continue;
68 const localName = property.value.name;
69 if (keyObjectClassNames.has(keyName)) {
70 keyObjectConstructorNames.add(localName);
71 } else if (cryptoKeyClassNames.has(keyName)) {
72 cryptoKeyConstructorNames.add(localName);
73 }
74 }
75 }
76
77 function constructorKind(node) {
78 if (node.type === 'Identifier') {

Callers

nothing calls this directly

Calls 3

isKeyModuleRequireFunction · 0.85
addMethod · 0.65
hasMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…