Add undefinedReplacement option to diffJson#156
Conversation
src/diff/json.js
Outdated
| options = {}; | ||
| } | ||
|
|
||
| jsonDiff.undefinedReplacement = options.undefinedReplacement; |
There was a problem hiding this comment.
I had to assign undefinedReplacement directly to jsonDiff because this.options is overriden each time at the base#diff method (https://github.com/kpdecker/jsdiff/blob/master/src/diff/base.js#L10).
There was a problem hiding this comment.
Humm. This is not ideal as it causes side effects in the global space. Did you try to pass options through?
test/diff/json.js
Outdated
| ]); | ||
| }); | ||
|
|
||
| it('should handle callback', function(done) { |
There was a problem hiding this comment.
I had to add this to keep coverage at 100% which was dropped due to the code below
if (typeof options === 'function') {
callback = options;
options = {};
}
src/diff/json.js
Outdated
| options = {}; | ||
| } | ||
|
|
||
| jsonDiff.undefinedReplacement = options.undefinedReplacement; |
There was a problem hiding this comment.
Humm. This is not ideal as it causes side effects in the global space. Did you try to pass options through?
|
My apologies for distraction, it's indeed working with just options. If I recall correctly, I was trying to keep signature of I've pushed a new commit with changes |
|
@kpdecker Could you release a new version on npm, please? |
|
Released in 3.2.0 |
Fixes #155
Please, let me know if I need to change styling / rename
undefinedReplacementto something more concise / anything else.