tracer: fix stringifying arrays (#2353)

issue: The Array.isArray(value) check at line 113 will never be reached because arrays are also objects in JavaScript. The earlier check at line 105 (typeof value === 'object') will catch arrays first and pass them to stringifyObj(), making the array-specific handling code unreachable.
This commit is contained in:
Ulugbek Abdullaev
2025-12-03 14:43:43 +01:00
committed by GitHub
parent e63188cacb
commit 6843bcd5ef
@@ -102,10 +102,6 @@ export class Tracer implements ITracer {
return value;
}
if (typeof value === 'object') {
return stringifyObj(value);
}
if (typeof value === 'function') {
return value.name ? `[Function: ${value.name}]` : '[Function]';
}
@@ -114,6 +110,10 @@ export class Tracer implements ITracer {
return `[${value.map(v => this.stringify(v)).join(', ')}]`;
}
if (typeof value === 'object') {
return stringifyObj(value);
}
const valueToString = value.toString();
if (valueToString && valueToString !== '[object Object]') {
return valueToString;