mirror of
https://github.com/flynx/diff.js.git
synced 2025-10-29 11:00:12 +00:00
experimenting with diff actions...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
90f389ab38
commit
67f0e02669
23
diff.js
23
diff.js
@ -2122,6 +2122,29 @@ var DiffPrototype = {
|
|||||||
unpatch: function(obj){
|
unpatch: function(obj){
|
||||||
return this.reverse().patch(obj) },
|
return this.reverse().patch(obj) },
|
||||||
|
|
||||||
|
// XXX .filter(..) -- keep only part of the changes and generate a new diff...
|
||||||
|
// ...should accept a path pattern (glob) as well as a function...
|
||||||
|
filter: function(filter){
|
||||||
|
var res = this.clone()
|
||||||
|
|
||||||
|
// path filter...
|
||||||
|
if(!(filter instanceof Function)){
|
||||||
|
var path = filter instanceof Array ? filter : [filter]
|
||||||
|
|
||||||
|
filter = function(change, i, lst){
|
||||||
|
// XXX
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// XXX should we add filter to options or at least set a .filtered attr???
|
||||||
|
// ...or maybe a reference to the original diff...
|
||||||
|
// ...might event implement a jQuery-like .end()
|
||||||
|
|
||||||
|
res.diff = res.diff.filter(filter.bind(this))
|
||||||
|
|
||||||
|
return res
|
||||||
|
},
|
||||||
|
|
||||||
// XXX need to normalize .diff and .options...
|
// XXX need to normalize .diff and .options...
|
||||||
json: function(){
|
json: function(){
|
||||||
return {
|
return {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user