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

Allow printing of the parsed state of a media-type #2

Open
ThisIsMissEm opened this issue Mar 13, 2014 · 3 comments
Open

Allow printing of the parsed state of a media-type #2

ThisIsMissEm opened this issue Mar 13, 2014 · 3 comments
Milestone

Comments

@ThisIsMissEm
Copy link

E.g.,

console.dir( mediaType.fromString("image/svg+xml;charset=utf8;foo=bar") )

> { ... }

Rather than a String. This change would make debugging parsed objects easier, and the API more discoverable.

@lovell
Copy link
Owner

lovell commented Mar 13, 2014

Great idea. In essence you'd like inspect() to return an object where currently toString() is re-used.

@lovell lovell added this to the v0.0.3 milestone Mar 13, 2014
@ThisIsMissEm
Copy link
Author

Yup! Not sure how to implement this though, I did try earlier.

@lovell
Copy link
Owner

lovell commented Mar 14, 2014

console.dir() explicitly prevents the use of custom inspect() methods.

I'm thinking a minor API change is probably the best way to support this, renaming toString() to be the slightly more fluent asString(). This would then allow util.inspect() to use its built-in object inspection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants