mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-29 11:42:17 +00:00
Ported from the reference's formatConsoleTable: one tab-separated line per row under an (index) header, object rows spread into their keys (or the chosen columns), primitives under Value, strings unquoted and other cells in the console's format. Data holding a function or other opaque reference logs [opaque reference]. console.dir() with no argument now logs undefined, as in the reference.
15 lines
583 B
JavaScript
15 lines
583 B
JavaScript
console.table([{ a: 1, b: "x" }, { b: 2, c: [1, 2] }, 5, "s", [1, 2]])
|
|
console.table({ r1: { x: 1 }, r2: { y: { z: 1 } }, r3: null })
|
|
console.table([{ a: 1, b: 2 }, { a: 3 }], ["b", "a", "zz"])
|
|
console.table(5)
|
|
console.table("str")
|
|
console.table()
|
|
console.table(undefined)
|
|
console.table([{ f: () => 1 }])
|
|
console.table(new Map([[1, 2]]))
|
|
console.table([{ 2: "two", 1: "one", b: "b" }, { 10: "ten" }])
|
|
console.table([new Date(0), /x/g, null, undefined, true])
|
|
console.table({ a: { toString() { return 1 } } }, [{ toString() { return "a" } }])
|
|
console.dir()
|
|
console.dir(1, 2)
|
|
return 1
|