Skip to content

Commit 2cc414d

Browse files
committed
Dive into arrays.
1 parent 5bac9cc commit 2cc414d

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

Diff for: .npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

Diff for: spec/spec-diff.coffee

+3
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ describe 'diff', ->
1919

2020
it 'should produce diff with undefined', ->
2121
y { $set: { foo: undefined } }, $.diff { foo: 1 }, { foo: undefined }
22+
23+
it 'should work on nested arrays', ->
24+
y { $set: { 'x.0.z': false } }, $.diff { x: [ { y: true, z: true } ] }, { x: [ { y: true, z: false } ] }

Diff for: spec/spec-index.coffee

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ describe 'diff', ->
144144
it 'should work with bson types', ->
145145
a = new bson.ObjectId
146146
b = new bson.ObjectId
147-
assert.deepEqual $.diff({foo:a}, {foo:b}), { $set: { foo: b } }
147+
assert.deepEqual $.diff({foo:a}, {foo:b}), { $set: { 'foo.id': b.id } }
148148

149149
a = new bson.ObjectId '5516058702c536d6068cabb7'
150150
b = new bson.ObjectId '5516058702c536d6068cabb7'

Diff for: src/index.coffee

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ isRealNumber = (args...) ->
88

99
# Check if object is plain object.
1010
isPlainObject = (a) ->
11-
a isnt null and typeof a is 'object' and a.constructor is Object
11+
a isnt null and typeof a is 'object'
1212

1313
# Compute difference between two JSON objects.
1414
#

0 commit comments

Comments
 (0)