From: Mike Taylor Date: Wed, 23 Apr 2014 16:24:13 +0000 (+0100) Subject: Add filterSet.visitTargets and filterSet.visitFields methods. X-Git-Tag: 1.0.0~871 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=b77d3c71a27d3ef8323789281ea88efdebc158b5;p=mkws-moved-to-github.git Add filterSet.visitTargets and filterSet.visitFields methods. --- diff --git a/src/mkws-filter.js b/src/mkws-filter.js index 219ccd5..e37a0bd 100644 --- a/src/mkws-filter.js +++ b/src/mkws-filter.js @@ -13,6 +13,24 @@ function filterSet(team) { m_list.push(filter); }; + that.visitTargets = function(callback) { + for (var i in m_list) { + var filter = m_list[i]; + if (filter.id) { + callback(filter.id, filter.name); + } + } + }; + + that.visitFields = function(callback) { + for (var i in m_list) { + var filter = m_list[i]; + if (!filter.id) { + callback(filter.field, filter.value); + } + } + }; + that.removeMatching = function(matchFn) { var newList = []; for (var i in m_list) {