From b77d3c71a27d3ef8323789281ea88efdebc158b5 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Wed, 23 Apr 2014 17:24:13 +0100 Subject: [PATCH] Add filterSet.visitTargets and filterSet.visitFields methods. --- src/mkws-filter.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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) { -- 1.7.10.4