doc fixes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2018-08-25 20:11:12 +03:00
parent 1b0e03cf44
commit 63e8375926

View File

@ -66,18 +66,15 @@ var Ted = {
var Diff = require('object-diff').Diff var Diff = require('object-diff').Diff
var diff = Diff(Bill, Ted) var diff = Diff(Bill, Ted)
// and log out the relevant part...
console.log(diff.diff)
``` ```
Here's how different `Bill` and `Ted` really are (or how the *diff* looks like): Here's how different `Bill` and `Ted` really are (or how the *diff* looks like):
```javascript ```javascript
// log out the relevant part... // log out the relevant part...
console.log(diff.diff) JSON.stringify(diff.diff, null, '\t')
``` ```
And the output is: And the output is:
```javascript ```json
[ [
{ {
"path": ["name"], "path": ["name"],
@ -125,12 +122,15 @@ var Bill2 = JSON.parse(JSON.stringify(Bill))
// now apply the patch... // now apply the patch...
diff.patch(Bill2) diff.patch(Bill2)
console.log(Bill2)
``` ```
Since we applied all the changes to `Bill2`, now he looks just like `Ted`: Since we applied all the changes to `Bill2`, now he looks just like `Ted`:
```javascript ```javascript
JSON.stringify(Bill2, null, '\t')
```
```json
{ {
"name": "Ted", "name": "Ted",
"age": 20, "age": 20,
@ -156,6 +156,9 @@ diff
Now, `Bill` can also play guitar! Now, `Bill` can also play guitar!
```javascript
JSON.stringify(Bill, null, '\t')
```
```json ```json
{ {
"name": "Bill", "name": "Bill",