mirror of
https://github.com/flynx/diff.js.git
synced 2025-10-28 10:30:09 +00:00
minor tweaking and cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
b01c82036c
commit
33b6e0d6d8
@ -122,7 +122,7 @@ diff.patch(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 is just another `Ted` (or rather `Ted`'s copy):
|
||||
|
||||
```javascript
|
||||
//JSON.stringify(Bill2, null, '\t')
|
||||
|
||||
25
diff.js
25
diff.js
@ -955,6 +955,8 @@ module.Types = {
|
||||
},
|
||||
|
||||
|
||||
// User API...
|
||||
|
||||
// Reverse diff...
|
||||
//
|
||||
reverse: function(diff){
|
||||
@ -1092,9 +1094,6 @@ module.Types = {
|
||||
return this.flatten(diff).concat(this.flatten(other))
|
||||
},
|
||||
|
||||
|
||||
// User API...
|
||||
|
||||
// Build a diff between A and B...
|
||||
//
|
||||
// NOTE: this will include direct links to items.
|
||||
@ -1253,6 +1252,16 @@ module.Types = {
|
||||
})
|
||||
.pop())
|
||||
},
|
||||
// Call the post-patch method of the handlers...
|
||||
//
|
||||
postPatch: function(res){
|
||||
var that = this
|
||||
return [...this.types]
|
||||
.filter(function(e){
|
||||
return !!e.postPatch })
|
||||
.reduce(function(r, e){
|
||||
return e.postPatch.call(that, r) }, res) },
|
||||
|
||||
|
||||
// XXX need to support different path element types...
|
||||
// ...in addition to Object and Array items, support Map, Set, ...
|
||||
@ -1329,15 +1338,7 @@ module.Types = {
|
||||
})
|
||||
.pop())
|
||||
},
|
||||
// Call the post-patch method of the handlers...
|
||||
//
|
||||
postPatch: function(res){
|
||||
var that = this
|
||||
return [...this.types]
|
||||
.filter(function(e){
|
||||
return !!e.postPatch })
|
||||
.reduce(function(r, e){
|
||||
return e.postPatch.call(that, r) }, res) },
|
||||
|
||||
|
||||
// Check if diff is applicable to obj...
|
||||
//
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user