Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

util: show meaningful values for boxed primitives #7056

Closed
wants to merge 1 commit into from
Closed

util: show meaningful values for boxed primitives #7056

wants to merge 1 commit into from

Conversation

TooTallNate
Copy link

Before, new String('foo') would be inspected as "{}" which is simply not
very helpful. Now, a more meaningful "[String: 'foo']" result will be
returned from util.inspect().

Boxed String, Boolean, and Number types are all supported.

Closes #7047

@Nodejs-Jenkins
Copy link

Thank you for contributing this pull request! Here are a few pointers to make sure your submission will be considered for inclusion.

Commit TooTallNate/node@5890d8d653662fca914b24eae471ef2e35abdd87 has the following error(s):

  • Commit message line too long: 2

The following commiters were not found in the CLA:

  • Nathan Rajlich

You can fix all these things without opening another issue.

Please see CONTRIBUTING.md for more information

Before, `new String('foo')` would be inspected as `"{}"` which
is simply not very helpful. Now, a more meaningful
`"[String: 'foo']"` result will be returned from `util.inspect()`.

Boxed String, Boolean, and Number types are all supported.

Closes #7047
@TooTallNate
Copy link
Author

@Nodejs-Jenkins Fixed long commit message. I'm reasonably sure that I've already signed the CLA ;)

@jed
Copy link

jed commented Feb 6, 2014

Nice!

@reconbot
Copy link

reconbot commented Feb 6, 2014

👍 and =)

@indutny
Copy link
Member

indutny commented Feb 6, 2014

LGTM

var raw = value;
try {
// the .valueOf() call can fail for a multitude of reasons
raw = value.valueOf();
Copy link
Member

Choose a reason for hiding this comment

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

This isn't handling Date properly, but I'll patch it up.

@indutny
Copy link
Member

indutny commented Feb 6, 2014

Thank you, landed with minor fixes in 8874a31

@indutny indutny closed this Feb 6, 2014
@TooTallNate TooTallNate deleted the update/util-inspect-boxed-primitives branch February 6, 2014 19:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants