Skip to content

Commit e0e960a

Browse files
Document diffJson() options (#332)
* Document diffJson() options * Tweaks: fix run-on sentences; backtick JSON.stringify; name the JSON.stringify parameter this is similar to * Add full stop * Correct docs about how stringifyReplacer & undefinedReplacement interact --------- Co-authored-by: Mark Amery <markrobertamery@gmail.com>
1 parent 87dedb6 commit e0e960a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ npm install diff --save
5656
* `Diff.diffJson(oldObj, newObj[, options])` - diffs two JSON objects, comparing the fields defined on each. The order of fields, etc does not matter in this comparison.
5757

5858
Returns a list of [change objects](#change-objects).
59+
60+
Options
61+
* `stringifyReplacer`: A custom replacer function. Operates similarly to the `replacer` parameter to [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#the_replacer_parameter), but must be a function.
62+
* `undefinedReplacement`: A value to replace `undefined` with. Ignored if a `stringifyReplacer` is provided.
5963

6064
* `Diff.diffArrays(oldArr, newArr[, options])` - diffs two arrays, comparing each item for strict equality (===).
6165

0 commit comments

Comments
 (0)