Skip to content

Commit a29c1b6

Browse files
updated vsn, built release package
1 parent c4c6351 commit a29c1b6

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

Readme.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
## ChangeLog
1313

14+
`0.1.7` - [Enhancement #11](https://github.com/flitbit/diff/issues/11) Added the ability to filter properties that should not be analyzed while calculating differences. Makes `deep-diff` more usable when other frameworks attach housekeeping properties to existing objects. AngularJS does exactly such, and this filter ability should ease working with it.
15+
1416
`0.1.6` - Changed objects within nested arrays can now be applied. They were previously recording the changes appropriately but `applyDiff` would error. Comparison of `NaN` works more sanely - comparison to number shows difference, comparison to another `Nan` does not.
1517

1618
## Installation
@@ -171,4 +173,18 @@ A standard import of `var diff = require('deep-diff')` is assumed in all of the
171173
* `applyDiff` - a function that applies any structural differences from one object to another.
172174
* `applyChange` - a function that applies a single change record to an origin object.
173175

176+
### `diff`
177+
178+
The `diff` function calculates the difference between two objects. In version `0.1.7` you can supply your own `prefilter` function as the 3rd arguement and control which properties are ignored while calculating differences throughout the object graph.
179+
180+
**Arguments**
181+
182+
+ `lhs` - the left-hand operand; the origin object.
183+
+ `rhs` - the right-hand operand; the object being compared structurally with the origin object.
184+
+ `prefilter` - an optional function that determines whether difference analysis should continue down the object graph.
185+
+ `acc` - an optional accumulator/array (requirement is that it have a `push` function). Each difference is pushed to the specified accumulator.
186+
187+
#### Pre-filtering Object Properties
188+
189+
The `prefilter`'s signature should be `function(path, key)` and it should return a truthy value for any `path`-`key` combination that should be filtered. If filtered, the difference analysis does no further analysis of on the identified object-property path.
174190

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "deep-diff",
33
"description": "Javascript utility for calculating deep difference, capturing changes, and applying changes across objects; for nodejs and the browser.",
4-
"version": "0.1.6",
4+
"version": "0.1.7",
55
"keywords": [
66
"diff",
77
"difference",

releases/deep-diff-0.1.7.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/tests.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
DeepDiff = { Conflict: "here" };
1818
DeepDiffConflict = DeepDiff;
1919
</script>
20-
<!--<script src="../releases/deep-diff-0.1.5.min.js"></script>-->
21-
<script src="../index.js"></script>
20+
<script src="../releases/deep-diff-0.1.7.min.js"></script>
21+
<!--script src="../index.js"></script-->
2222
<script>mocha.setup('bdd')</script>
2323
<script src="tests.js"></script>
2424

0 commit comments

Comments
 (0)