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

Function getKeys

lib/internal/util/inspect.js:1051–1077  ·  view source on GitHub ↗
(value, showHidden)

Source from the content-addressed store, hash-verified

1049
1050// Look up the keys of the object.
1051function getKeys(value, showHidden) {
1052 let keys;
1053 const symbols = ObjectGetOwnPropertySymbols(value);
1054 if (showHidden) {
1055 keys = ObjectGetOwnPropertyNames(value);
1056 if (symbols.length !== 0)
1057 ArrayPrototypePushApply(keys, symbols);
1058 } else {
1059 // This might throw if `value` is a Module Namespace Object from an
1060 // unevaluated module, but we don't want to perform the actual type
1061 // check because it's expensive.
1062 // TODO(devsnek): track https://github.com/tc39/ecma262/issues/1209
1063 // and modify this logic as needed.
1064 try {
1065 keys = ObjectKeys(value);
1066 } catch (err) {
1067 assert(isNativeError(err) && err.name === 'ReferenceError' &&
1068 isModuleNamespaceObject(value));
1069 keys = ObjectGetOwnPropertyNames(value);
1070 }
1071 if (symbols.length !== 0) {
1072 const filter = (key) => ObjectPrototypePropertyIsEnumerable(value, key);
1073 ArrayPrototypePushApply(keys, ArrayPrototypeFilter(symbols, filter));
1074 }
1075 }
1076 return keys;
1077}
1078
1079function getCtxStyle(value, constructor, tag) {
1080 let fallback = '';

Callers 1

formatRawFunction · 0.85

Calls 1

assertFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…