Skip to content

Commit

Permalink
Clarify hash function for objects vs other values. See #32
Browse files Browse the repository at this point in the history
  • Loading branch information
briancavalier committed Jan 11, 2016
1 parent 2b42270 commit 4a91365
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Computes and returns a JSON Patch from `a` to `b`: `a` and `b` must be valid JSO
The optional third parameter can be *either* an `options` object (preferably) or a function (deprecated: allowed backward compatibility).

* `options`:
* `options.hash : function(x) -> string|number`: used to recognize when two objects are the same. If not provided, `JSON.stringify` will be used.
* `options.hash : function(x) -> string|number`: used to recognize when two objects are the same. If not provided, `JSON.stringify` will be used for *objects*, and simply returns `x` for all other values (including arrays).
* `options.makeContext : function(index, array) -> *`: **Experimental** function that will be called for each item added or removed from an array. It can return *any* legal JSON value or undefined, which if not `null` or undefined, will be fed directly to the `findContext` function provided to [`jiff.patch`](#patch).
* `options.invertible : boolean`: by default, jiff generates patches containing extra `test` operations to ensure they are invertible via [`jiff.inverse`](#inverse). When `options.invertible === false` will omit the extra `test` operations. This will result in smaller patches, but they will not be invertible.
* `hashFunction(x) -> string|number`: same as `options.hash` above
Expand Down

0 comments on commit 4a91365

Please sign in to comment.