Allow printing of the parsed state of a media-type
Opened this issue · 3 comments
ThisIsMissEm commented
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 commented
Great idea. In essence you'd like inspect() to return an object where currently toString() is re-used.
ThisIsMissEm commented
Yup! Not sure how to implement this though, I did try earlier.
lovell commented
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.