DISQUS

DISQUS Hello! Languages of the real and artificial is using DISQUS, a powerful comment system, to manage its comments. Learn more.

Community Page

  • Subscribe

  • Community

  • Top Commenters

  • Popular Threads

  • Recent Comments

    • NoTV service is not available in my area. Something about low demand :)

      5 months ago by Theo

      in My No TV

    • I also read recently about Ethanol polluting more than gasoline. Not sure if its true coz I couldn’t keep up with all of the chemistry..but im very much interested with fuels becoz im a car...

      5 months ago by eurotive

      in The Biofuel Economy

    • We got NOtv when we lost cross country wireless and moved to a new house. We found that DSL was a better item and we can actually limit what we see. The NOtv has been a shock to many folks who are...

      5 months ago by mypc46

      in My No TV

    • Absolutely beautiful post. Thirty minutes after reading it, my whole way of doing git business has changed.

      5 months ago by Gavin

      in Commit Policies

    • Wow, this is awesome! You should talk a little more about the code behind how this works, would be a great read.

      5 months ago by fernO

      in Visualizing Regular Expressions

Jump to original thread »
Author

Readable JavaScript Values

Started by osteele · 6 months ago

One problem with JavaScript development is that the string representation of a value doesn't tell you much about the value. For example, [null], [undefined], and '' all display as the empty string. % ... Continue reading »

6 comments

  • How does this compare to JSON?
  • Good question. In brief, JSON output is intended for consumption by computers and by libraries written in other languages, and Readable output is intended for humans. This has all sorts of repercussions such as whether RegExps, null, undefined, and NaN are represented; whether representations can be limited in length or depth, and so on. For a longer answer, see the bottom of the docs http://osteele.com/sources/javascript/docs/read..., where I've just added a list of differences.
  • Thanks, Oliver.
    This is a much needed tool that saved the day today and I'm sure on many future days.
    Good work! Now to spread the word.
  • Thanks Oliver. This is very handy.

    I'm starting to code thicker clients with javascript and I've been looking for cool debugging tools like this.

    Is it okay if I try merging this with jquery.debug?
    http://jquery.glyphix.com/

    Also, I believe the first check for null and undefined in Readable.toReadable(value,options) should return a "new String(value)" and not "String(value)".
  • Nope, not sure what i was witnessing, but new String(value) is wrong too. String(value) is now working for me. Readable.toReadable(null) returns a string now
  • I think your constructor checks in Readable.toReadable(value,options) for Regexp, String etc should also include Date to use the native toString() date stringifier.
Please login to comment.
Returning? Login