Skip to content
This repository was archived by the owner on Oct 17, 2021. It is now read-only.

Commit db75b54

Browse files
authored
Merge pull request #1 from sanukerinc/master
Update README.md
2 parents 22b6bf7 + bcbd076 commit db75b54

File tree

1 file changed

+33
-13
lines changed

1 file changed

+33
-13
lines changed

README.md

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
A small library that can deep diff two JavaScript Objects, including nested structures of arrays and objects.
1919

2020
## Installation
21-
`yarn add deep-object-diff`
22-
23-
`npm i --save deep-object-diff`
21+
`yarn add https://github.com/sanukerinc/deep-object-diff.git`
2422

2523
## Functions available:
2624
- [`diff(originalObj, updatedObj)`](#diff)
@@ -139,9 +137,13 @@ console.log(addedDiff(lhs, rhs));
139137
foo: {
140138
bar: {
141139
c: {
142-
'2': 'z'
140+
'2': {
141+
after: 'z'
142+
}
143143
},
144-
d: 'Hello, world!'
144+
d: {
145+
after: 'Hello, world!'
146+
}
145147
}
146148
}
147149
}
@@ -181,9 +183,13 @@ console.log(deletedDiff(lhs, rhs));
181183
foo: {
182184
bar: {
183185
a: {
184-
'1': undefined
186+
'1': {
187+
before: 'b'
188+
}
185189
},
186-
e: undefined
190+
e: {
191+
before: 'Hello, world!'
192+
}
187193
}
188194
}
189195
}
@@ -220,7 +226,10 @@ console.log(updatedDiff(lhs, rhs));
220226

221227
/*
222228
{
223-
buzz: 'fizz'
229+
buzz: {
230+
before: 'world'
231+
after: 'fizz'
232+
}
224233
}
225234
*/
226235
```
@@ -259,24 +268,35 @@ console.log(detailedDiff(lhs, rhs));
259268
foo: {
260269
bar: {
261270
c: {
262-
'2': 'z'
271+
'2': {
272+
after: 'z'
273+
}
263274
},
264-
d: 'Hello, world!'
275+
d: {
276+
after: 'Hello, world!'
277+
}
265278
}
266279
}
267280
},
268281
deleted: {
269282
foo: {
270283
bar: {
271284
a: {
272-
'1': undefined
285+
'1': {
286+
before: 'b'
287+
}
273288
},
274-
e: undefined
289+
e: {
290+
before: 100
291+
}
275292
}
276293
}
277294
},
278295
updated: {
279-
buzz: 'fizz'
296+
buzz: {
297+
before: 'world'
298+
after: 'fizz'
299+
}
280300
}
281301
}
282302
*/

0 commit comments

Comments
 (0)