mirror of
https://github.com/flynx/diff.js.git
synced 2025-10-29 02:50:10 +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 = 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",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user