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

File tree

8 files changed

+19
-13
lines changed

8 files changed

+19
-13
lines changed

Readme.md

Lines changed: 3 additions & 0 deletions
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

Lines changed: 2 additions & 1 deletion
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 <phillip@flitbit.com>",
@@ -17,6 +17,7 @@
1717
"ZauberNerd <zaubernerd@zaubernerd.de>",
1818
"ravishivt <javishi@gmail.com>",
1919
"Daniel Spangler <daniel.spangler@gmail.com>",
20+
"Sam Beran <sberan@gmail.com>",
2021
"Thomas de Barochez <thomas.barochez+github@gmail.com>",
2122
"Morton Fox <github@qslw.com>",
2223
"Amila Welihinda <amilajack@users.noreply.github.com>",

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

index.es.js

Lines changed: 7 additions & 7 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 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.3.6",
4+
"version": "0.3.7",
55
"license": "MIT",
66
"keywords": [
77
"diff",
@@ -23,6 +23,7 @@
2323
"ZauberNerd <zaubernerd@zaubernerd.de>",
2424
"ravishivt <javishi@gmail.com>",
2525
"Daniel Spangler <daniel.spangler@gmail.com>",
26+
"Sam Beran <sberan@gmail.com>",
2627
"Thomas de Barochez <thomas.barochez+github@gmail.com>",
2728
"Morton Fox <github@qslw.com>",
2829
"Amila Welihinda <amilajack@users.noreply.github.com>",

releases/deep-diff-0.3.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: 1 addition & 1 deletion
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)