MCPcopy Create free account
hub / github.com/Noumena-Network/code / buildDescription

Function buildDescription

src/utils/slowOperations.ts:76–95  ·  view source on GitHub ↗

* Builds a human-readable description from tagged template arguments. * Only called when an operation was actually slow — never on the fast path. * * args[0] = TemplateStringsArray, args[1..n] = interpolated values

(args: IArguments)

Source from the content-addressed store, hash-verified

74 * args[0] = TemplateStringsArray, args[1..n] = interpolated values
75 */
76function buildDescription(args: IArguments): string {
77 const strings = args[0] as TemplateStringsArray
78 let result = ''
79 for (let i = 0; i < strings.length; i++) {
80 result += strings[i]
81 if (i + 1 < args.length) {
82 const v = args[i + 1]
83 if (Array.isArray(v)) {
84 result += `Array[${(v as unknown[]).length}]`
85 } else if (v !== null && typeof v === 'object') {
86 result += `Object{${Object.keys(v as Record<string, unknown>).length} keys}`
87 } else if (typeof v === 'string') {
88 result += v.length > 80 ? `${v.slice(0, 80)}…` : v
89 } else {
90 result += String(v)
91 }
92 }
93 }
94 return result
95}
96
97class AntSlowLogger {
98 startTime: number

Callers 1

[Symbol.dispose]Method · 0.85

Calls 1

keysMethod · 0.80

Tested by

no test coverage detected