mirror of
https://github.com/flynx/diff.js.git
synced 2026-01-04 09:41:20 +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)...
|
// path filter (non-function)...
|
||||||
if(!(filter instanceof Function)){
|
if(!(filter instanceof Function)){
|
||||||
|
// normalize path...
|
||||||
// format:
|
// format:
|
||||||
// [
|
// [
|
||||||
// '**' | [ .. ],
|
// '**' | [ .. ],
|
||||||
@ -2152,6 +2153,7 @@ var DiffPrototype = {
|
|||||||
: res[n].push(e)
|
: res[n].push(e)
|
||||||
return res
|
return res
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
// min length...
|
// min length...
|
||||||
var min = path
|
var min = path
|
||||||
.reduce(function(l, e){
|
.reduce(function(l, e){
|
||||||
@ -2161,7 +2163,12 @@ var DiffPrototype = {
|
|||||||
var test = function(p, pattern, path){
|
var test = function(p, pattern, path){
|
||||||
return p == '**' ?
|
return p == '**' ?
|
||||||
// compare next pattern section and path...
|
// 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...
|
// shift path and test...
|
||||||
// XXX need to stop if we run put of path...
|
// XXX need to stop if we run put of path...
|
||||||
|| (test(p,
|
|| (test(p,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user