deno_std
deno_std copied to clipboard
bug(util/format): Doesn't add length to arrays formatted with `%o` and has missing spaces
deno eval "import * as util from 'https://deno.land/[email protected]/node/util.ts';console.log(util.format('%o', [10, 11]))"
outputs
[10, 11]
while
node -e 'const util = require("util");console.log(util.format("%o", [10, 11]))'
outputs
[ 10, 11, [length]: 2 ]
Hi ! I did some analysis. util.format internally calls Deno.inspect and that is where behavior is differs from Node's util.inspect
Node util.inspect
Welcome to Node.js v17.1.0.
Type ".help" for more information.
> let a = [1, 2]
undefined
> util.inspect(a, true)
'[ 1, 2, [length]: 2 ]'
> '[ 1, 2, [length]: 2 ]'
Deno.inspect
Deno 1.15.2
exit using ctrl+d or close()
> let a = [1,2]
undefined
> Deno.inspect(a)
"[ 1, 2 ]"
> Deno.inspect(a, { showHidden: true});
"[ 1, 2 ]"
I guess we should move this bug to deno lib ?
@grian32 thanks for reporting that issue. I have submitted a pr to fix this issue.