From: Mike Taylor Date: Thu, 24 Apr 2014 09:38:58 +0000 (+0100) Subject: Replace filter factory function with explicit targetFilter and X-Git-Tag: 1.0.0~861 X-Git-Url: http://git.indexdata.com/?p=mkws-moved-to-github.git;a=commitdiff_plain;h=7b6c3ddc940efb1bc499d33a3a2ec0ffc53a4729 Replace filter factory function with explicit targetFilter and fieldFilter factories. These objects know their own types. Currently that type is not used, but that will change. --- diff --git a/src/mkws-filter.js b/src/mkws-filter.js index f19edcb..c2bc711 100644 --- a/src/mkws-filter.js +++ b/src/mkws-filter.js @@ -85,15 +85,21 @@ function filterSet(team) { } -// Factory function for filters. These can be of several types. -function filter(id, name, field, value) { - var res; - - if (id) { - res = { id: id, name: name }; - } else { - res = { field: field, value: value }; - } +// Factory functions for filters. These can be of several types. +function targetFilter(id, name) { + return { + type: 'target', + id: id, + name: name + }; return res; } + +function fieldFilter(field, value) { + return { + type: 'field', + field: field, + value: value + }; +}