diff options
Diffstat (limited to 'ext/console/02_console.js')
-rw-r--r-- | ext/console/02_console.js | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/ext/console/02_console.js b/ext/console/02_console.js index 3020c0794..8102707b5 100644 --- a/ext/console/02_console.js +++ b/ext/console/02_console.js @@ -53,6 +53,8 @@ RegExpPrototype, RegExpPrototypeTest, RegExpPrototypeToString, + SafeArrayIterator, + SafeSet, SetPrototype, SetPrototypeEntries, Symbol, @@ -1938,11 +1940,14 @@ const [first, ...rest] = args; if (typeof first === "string") { - this.error(`Assertion failed: ${first}`, ...rest); + this.error( + `Assertion failed: ${first}`, + ...new SafeArrayIterator(rest), + ); return; } - this.error(`Assertion failed:`, ...args); + this.error(`Assertion failed:`, ...new SafeArrayIterator(args)); }; count = (label = "default") => { @@ -1994,7 +1999,7 @@ const indexKey = isSet || isMap ? "(iter idx)" : "(idx)"; if (isSet) { - resultData = [...data]; + resultData = [...new SafeSet(data)]; } else if (isMap) { let idx = 0; resultData = {}; @@ -2048,12 +2053,16 @@ const headerKeys = ObjectKeys(objectValues); const bodyValues = ObjectValues(objectValues); + const headerProps = properties || + [ + ...new SafeArrayIterator(headerKeys), + !isMap && hasPrimitives && valuesKey, + ]; const header = ArrayPrototypeFilter([ indexKey, - ...(properties || - [...headerKeys, !isMap && hasPrimitives && valuesKey]), + ...new SafeArrayIterator(headerProps), ], Boolean); - const body = [indexKeys, ...bodyValues, values]; + const body = [indexKeys, ...new SafeArrayIterator(bodyValues), values]; toTable(header, body); }; @@ -2080,7 +2089,7 @@ const startTime = MapPrototypeGet(timerMap, label); const duration = DateNow() - startTime; - this.info(`${label}: ${duration}ms`, ...args); + this.info(`${label}: ${duration}ms`, ...new SafeArrayIterator(args)); }; timeEnd = (label = "default") => { @@ -2100,7 +2109,7 @@ group = (...label) => { if (label.length > 0) { - this.log(...label); + this.log(...new SafeArrayIterator(label)); } this.indentLevel += 2; }; |