Implemented diffJson - #28
Conversation
It takes two objects, serializes them as canonical JSON, then does a line-based diff that ignores differences in trailing commas. See discussion here: mochajs/mocha#1182
rooftopsparrow
commented
Aug 8, 2014
Bump... However, it would be great if it accepted an already stringified JSON as well. |
papandreou
commented
Aug 8, 2014
@rooftopsparrow There, that was easy enough :) In that case it's the caller's duty to stringify the arguments with the same indentation level -- and to canonicalize the objects before stringifying them. |
rooftopsparrow
commented
Aug 8, 2014
Fabulous! Works like a charm. |
There was a problem hiding this comment.
The toString method should be cached. Using the object literal adds a bit of overhead.
kpdecker
commented
Sep 2, 2014
This generally looks pretty good. A few minor questions and generally wondering if those questions should have comments in the code explaining them but outside of that I'd like to get this into master. (BTW the travis environment failure should hopefully be fixed in master) |
…bject each time it's used.
papandreou
commented
Sep 2, 2014
If my explanations are good enough, we can add them as comments in the code :) |
…ow (rather than an infinite loop).
…ject can be substituted when a circular reference is detected.
kpdecker
commented
Nov 29, 2014
I've fixed the merge conflicts and got this in. Thanks for writing this! |
kpdecker
commented
Nov 29, 2014
Released in 1.2.0 |
It takes two objects, serializes them as canonical JSON, then does a line-based diff that ignores differences in trailing commas.
See discussion here: mochajs/mocha#1182