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

std/node/util: add inspect #6833

Merged
merged 8 commits into from
Aug 12, 2020
Merged

std/node/util: add inspect #6833

merged 8 commits into from
Aug 12, 2020

Conversation

balupton
Copy link
Contributor

@balupton balupton commented Jul 22, 2020

basic compatibility, none of the advanced features

fix #6832

basic compatibility, none of the advanced features
@ry
Copy link
Member

ry commented Jul 23, 2020

please run tools/format.py --js

@ry
Copy link
Member

ry commented Jul 23, 2020

Maybe use Deno.insepct ?

@CLAassistant
Copy link

CLAassistant commented Jul 27, 2020

CLA assistant check
All committers have signed the CLA.

@balupton
Copy link
Contributor Author

Maybe use Deno.insepct ?

I can't figure out how to import it and its InspectOptions type, as:

import type { InspectOptions } from "../../cli/js2/lib.deno.ns.d.ts";

export function inspect(object: unknown, options?: InspectOptions) {
  return Deno.inspect(object, options);
}

doesn't have any syntax errors, but when I try to use it, the types are missing

@nayeemrmn
Copy link
Collaborator

nayeemrmn commented Jul 30, 2020

@balupton It's Deno.inspect() and Deno.InspectOptions respectively. Example usage:

? Deno.inspect(v, {
depth: Infinity,
sorted: true,
trailingComma: true,
compact: false,
iterableLimit: Infinity,
})


Deno.inspect() differs from Node's in that it favours double quotes over single quotes for inspecting strings. I think that's okay for now, but could you also document it in the JSDoc?

@balupton
Copy link
Contributor Author

Correct, as indicated by the correct spelling in my code snippet. However the issue is I can't figure out how to import the types, the snippet doesn't seem to do what it should. If someone can finish this PR I would be much appreciated.

std/node/util.ts Outdated Show resolved Hide resolved
@bartlomieju
Copy link
Member

@balupton please sign CLA

@bartlomieju
Copy link
Member

@balupton can you add some small unit test?

@bartlomieju bartlomieju added this to the 1.3.0 milestone Aug 12, 2020
Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks @balupton

@ry ry merged commit 4526932 into denoland:master Aug 12, 2020
@balupton
Copy link
Contributor Author

balupton commented Aug 18, 2020

moved comment to new issue:
#7099

@balupton balupton deleted the patch-1 branch August 18, 2020 00:50
std/node/util.ts Outdated Show resolved Hide resolved
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 21, 2021
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 24, 2021
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 24, 2021
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 24, 2021
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 31, 2021
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 31, 2021
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 31, 2021
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 31, 2021
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

std/node/util: missing inspect
6 participants