mirror of
https://github.com/flynx/diff.js.git
synced 2025-10-29 02:50:10 +00:00
working on .filter(path)...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
8b07ea9487
commit
e5489b51a8
9
diff.js
9
diff.js
@ -2133,6 +2133,7 @@ var DiffPrototype = {
|
||||
|
||||
// path filter (non-function)...
|
||||
if(!(filter instanceof Function)){
|
||||
// normalize path...
|
||||
// format:
|
||||
// [
|
||||
// '**' | [ .. ],
|
||||
@ -2152,6 +2153,7 @@ var DiffPrototype = {
|
||||
: res[n].push(e)
|
||||
return res
|
||||
}, [])
|
||||
|
||||
// min length...
|
||||
var min = path
|
||||
.reduce(function(l, e){
|
||||
@ -2161,7 +2163,12 @@ var DiffPrototype = {
|
||||
var test = function(p, pattern, path){
|
||||
return p == '**' ?
|
||||
// compare next pattern section and path...
|
||||
cmp(pattern[0], path.slice(0, next.length))
|
||||
(cmp(pattern[0], path.slice(0, next.length))
|
||||
// next pattern/path section
|
||||
// XXX need to stop if we run put of path or pattern...
|
||||
&& test(pattern[1],
|
||||
pattern.slice(2),
|
||||
path.slice(next.length)))
|
||||
// shift path and test...
|
||||
// XXX need to stop if we run put of path...
|
||||
|| (test(p,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user