mirror of
https://github.com/flynx/diff.js.git
synced 2025-10-28 18:40:09 +00:00
doc fixes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
1b0e03cf44
commit
63e8375926
17
README.md
17
README.md
@ -66,18 +66,15 @@ var Ted = {
|
||||
var Diff = require('object-diff').Diff
|
||||
|
||||
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):
|
||||
```javascript
|
||||
// log out the relevant part...
|
||||
console.log(diff.diff)
|
||||
JSON.stringify(diff.diff, null, '\t')
|
||||
```
|
||||
And the output is:
|
||||
```javascript
|
||||
```json
|
||||
[
|
||||
{
|
||||
"path": ["name"],
|
||||
@ -125,12 +122,15 @@ var Bill2 = JSON.parse(JSON.stringify(Bill))
|
||||
|
||||
// now apply the patch...
|
||||
diff.patch(Bill2)
|
||||
|
||||
console.log(Bill2)
|
||||
```
|
||||
|
||||
|
||||
Since we applied all the changes to `Bill2`, now he looks just like `Ted`:
|
||||
|
||||
```javascript
|
||||
JSON.stringify(Bill2, null, '\t')
|
||||
```
|
||||
```json
|
||||
{
|
||||
"name": "Ted",
|
||||
"age": 20,
|
||||
@ -156,6 +156,9 @@ diff
|
||||
|
||||
Now, `Bill` can also play guitar!
|
||||
|
||||
```javascript
|
||||
JSON.stringify(Bill, null, '\t')
|
||||
```
|
||||
```json
|
||||
{
|
||||
"name": "Bill",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user