filters: combine filters first
This commit is contained in:
parent
036b6d6099
commit
653a329698
@ -1,4 +1,4 @@
|
|||||||
define([], function () {
|
define(["filters/nodefilter"], function (NodeFilter) {
|
||||||
return function () {
|
return function () {
|
||||||
var targets = []
|
var targets = []
|
||||||
var filterObservers = []
|
var filterObservers = []
|
||||||
@ -26,9 +26,13 @@ define([], function () {
|
|||||||
if (data === undefined)
|
if (data === undefined)
|
||||||
return
|
return
|
||||||
|
|
||||||
filteredData = filters.reduce( function (a, f) {
|
var filter = filters.reduce( function (a, f) {
|
||||||
return f.run(a)
|
return function (d) {
|
||||||
}, data)
|
return a(d) && f.run(d)
|
||||||
|
}
|
||||||
|
}, function () { return true })
|
||||||
|
|
||||||
|
filteredData = new NodeFilter(filter)(data)
|
||||||
|
|
||||||
targets.forEach( function (t) {
|
targets.forEach( function (t) {
|
||||||
t.setData(filteredData)
|
t.setData(filteredData)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
define(["filters/nodefilter"], function (nodefilter) {
|
define([], function () {
|
||||||
return function (name, key, value, f) {
|
return function (name, key, value, f) {
|
||||||
var negate = false
|
var negate = false
|
||||||
var refresh
|
var refresh
|
||||||
@ -44,7 +44,7 @@ define(["filters/nodefilter"], function (nodefilter) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return { run: nodefilter(run),
|
return { run: run,
|
||||||
setRefresh: setRefresh,
|
setRefresh: setRefresh,
|
||||||
render: render
|
render: render
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user