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

Function findAllKeys

test/doctool/test-doc-api-json.mjs:58–76  ·  view source on GitHub ↗
(obj, allKeys = new Set())

Source from the content-addressed store, hash-verified

56}
57
58function findAllKeys(obj, allKeys = new Set()) {
59 for (const [key, value] of Object.entries(obj)) {
60 if (Number.isNaN(Number(key))) allKeys.add(key);
61 if (typeof value === 'object') findAllKeys(value, allKeys);
62
63 if (key === 'miscs') {
64 assert.ok(Array.isArray(value));
65 assert.ok(value.length);
66 value.forEach(validateMisc);
67 } else if (key === 'modules') {
68 assert.ok(Array.isArray(value));
69 assert.ok(value.length);
70 value.forEach(validateModule);
71 } else if (key === 'meta') {
72 validateMeta(value);
73 }
74 }
75 return allKeys;
76}
77
78const allExpectedKeys = new Set([
79 'added',

Callers 1

Calls 5

validateMetaFunction · 0.85
addMethod · 0.65
forEachMethod · 0.65
entriesMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…