Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

console.dir implementation difference with Node #7126

Closed
t829702 opened this issue Aug 20, 2020 · 4 comments
Closed

console.dir implementation difference with Node #7126

t829702 opened this issue Aug 20, 2020 · 4 comments
Labels
working as designed this is working as intended

Comments

@t829702
Copy link

t829702 commented Aug 20, 2020

#826 (comment)

this null treated as default to 2 is different with node:

in Node this null is treated as unlimited depth

> var o = { a: { b: { c: { d: new Date } } } };
undefined
> console.log(o)
{ a: { b: { c: [Object] } } }
> console.dir(o, { depth: null });
{
  a: { b: { c: { d: 2020-08-19T23:55:58.009Z } } }
}

I don't mean it should be exactly same as Node implementation, but better to be

@erfanium
Copy link
Contributor

I think console.dir(o, { depth: Infinity }); is more expressive than null

@bartlomieju
Copy link
Member

CC @nayeemrmn what's your take on this one?

@nayeemrmn
Copy link
Collaborator

Let's see... an explicit { depth: null } violates the type definition of Deno.InspectOptions. When something violates our types, we let it be undefined behaviour at runtime (except for web APIs). That applies here, Deno.inspect(value, { depth: null }) (and by extension console.dir(value, { depth: null })) is not supported.

I think console.dir(o, { depth: Infinity }); is more expressive than null

I agree. Rather than adding null to the types to match Node, let's wontfix this.

@bartlomieju
Copy link
Member

I agree with @nayeemrmn, closing as won't fix.

@bartlomieju bartlomieju added the working as designed this is working as intended label Nov 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
working as designed this is working as intended
Projects
None yet
Development

No branches or pull requests

4 participants