Skip to content

Commit f6f2e2a

Browse files
author
Phillip Clark
committed
moved @sberan`s contributions to index.es.js, release 0.3.7
1 parent 799707a commit f6f2e2a

8 files changed

+19
-13
lines changed

Readme.md

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
## ChangeLog
1414

15+
`0.3.7` - 2017-05-01
16+
* fixed issue #98 by merging @sberan's pull request #99 — better handling of property with `undefined` value existing on either operand. Unit tests supplied.
17+
1518
`0.3.6` - 2017-04-25 — Fixed, closed lingering issues:
1619
* fixed #74 — comparing objects with longer cycles
1720
* fixed #70 — was not properly detecting a deletion when a property on the operand (lhs) had a value of `undefined` and was _undefined_ on the comparand (rhs). :o).

bower.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "deep-diff",
33
"main": "index.js",
4-
"version": "0.3.6",
4+
"version": "0.3.7",
55
"homepage": "https://github.com/flitbit/diff",
66
"authors": [
77
"Phillip Clark <[email protected]>",
@@ -17,6 +17,7 @@
1717
"ZauberNerd <[email protected]>",
1818
"ravishivt <[email protected]>",
1919
"Daniel Spangler <[email protected]>",
20+
"Sam Beran <[email protected]>",
2021
"Thomas de Barochez <[email protected]>",
2122
"Morton Fox <[email protected]>",
2223
"Amila Welihinda <[email protected]>",

component.json

+1-1
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.3.6",
4+
"version": "0.3.7",
55
"license": "MIT",
66
"keywords": [
77
"diff",

index.es.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ function deepDiff(lhs, rhs, changes, prefilter, path, key, stack) {
143143

144144
var ltype = typeof lhs;
145145
var rtype = typeof rhs;
146-
if (ltype === 'undefined') {
147-
if (rtype !== 'undefined') {
148-
changes(new DiffNew(currentPath, rhs));
149-
} else {
150-
changes(new DiffDeleted(currentPath, lhs));
151-
}
152-
} else if (rtype === 'undefined') {
146+
147+
var ldefined = ltype !== 'undefined' || stack && stack[stack.length - 1].lhs.hasOwnProperty(key);
148+
var rdefined = rtype !== 'undefined' || stack && stack[stack.length - 1].rhs.hasOwnProperty(key);
149+
150+
if (!ldefined && rdefined) {
151+
changes(new DiffNew(currentPath, rhs));
152+
} else if (!rdefined && ldefined) {
153153
changes(new DiffDeleted(currentPath, lhs));
154154
} else if (realTypeOf(lhs) !== realTypeOf(rhs)) {
155155
changes(new DiffEdit(currentPath, lhs, rhs));

index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ function deepDiff(lhs, rhs, changes, prefilter, path, key, stack) {
151151
var ltype = typeof lhs;
152152
var rtype = typeof rhs;
153153

154-
var ldefined = ltype !== 'undefined' || stack && stack[stack.length - 1].lhs.hasOwnProperty(key)
155-
var rdefined = rtype !== 'undefined' || stack && stack[stack.length - 1].rhs.hasOwnProperty(key)
154+
var ldefined = ltype !== 'undefined' || stack && stack[stack.length - 1].lhs.hasOwnProperty(key);
155+
var rdefined = rtype !== 'undefined' || stack && stack[stack.length - 1].rhs.hasOwnProperty(key);
156156

157157
if (!ldefined && rdefined) {
158158
changes(new DiffNew(currentPath, rhs));

package.json

+2-1
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.3.6",
4+
"version": "0.3.7",
55
"license": "MIT",
66
"keywords": [
77
"diff",
@@ -23,6 +23,7 @@
2323
"ZauberNerd <[email protected]>",
2424
"ravishivt <[email protected]>",
2525
"Daniel Spangler <[email protected]>",
26+
"Sam Beran <[email protected]>",
2627
"Thomas de Barochez <[email protected]>",
2728
"Morton Fox <[email protected]>",
2829
"Amila Welihinda <[email protected]>",

releases/deep-diff-0.3.7.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/tests.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
};
2222
DeepDiffConflict = DeepDiff;
2323
</script>
24-
<script src="../releases/deep-diff-0.3.6.min.js"></script>
24+
<script src="../releases/deep-diff-0.3.7.min.js"></script>
2525
<!--script src="../index.js"></script-->
2626
<script>
2727
mocha.setup('bdd');

0 commit comments

Comments
 (0)