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

Function getPrefix

lib/internal/util/inspect.js:1026–1048  ·  view source on GitHub ↗

@type {(constructor: string, tag: string, fallback: string, size?: string) => string}

(constructor, tag, fallback, size = '')

Source from the content-addressed store, hash-verified

1024
1025/** @type {(constructor: string, tag: string, fallback: string, size?: string) => string} */
1026function getPrefix(constructor, tag, fallback, size = '') {
1027 if (constructor === null) {
1028 if (tag !== '' && fallback !== tag) {
1029 return `[${fallback}${size}: null prototype] [${tag}] `;
1030 }
1031 return `[${fallback}${size}: null prototype] `;
1032 }
1033
1034 let result = `${constructor}${size} `;
1035 if (tag !== '') {
1036 const position = constructor.indexOf(tag);
1037 if (position === -1) {
1038 result += `[${tag}] `;
1039 } else {
1040 const endPos = position + tag.length;
1041 if (endPos !== constructor.length &&
1042 constructor[endPos] === constructor[endPos].toLowerCase()) {
1043 result += `[${tag}] `;
1044 }
1045 }
1046 }
1047 return result;
1048}
1049
1050// Look up the keys of the object.
1051function getKeys(value, showHidden) {

Callers 3

getCtxStyleFunction · 0.85
formatRawFunction · 0.85
improveStackFunction · 0.85

Calls 1

indexOfMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…