From f6307fd1250676204721a12251c9ba9933a82608 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Wed, 23 Apr 2014 15:38:07 +0100 Subject: [PATCH] Add pp2limit method --- src/mkws-filter.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/mkws-filter.js b/src/mkws-filter.js index aa3a204..219ccd5 100644 --- a/src/mkws-filter.js +++ b/src/mkws-filter.js @@ -43,8 +43,7 @@ function filterSet(team) { for (var i in m_list) { var filter = m_list[i]; if (filter.id) { - if (res) - res += ","; + if (res) res += ","; if (filter.id.match(/^[a-z:]+[=~]/)) { m_team.log("filter '" + filter.id + "' already begins with SETTING OP"); } else { @@ -57,6 +56,21 @@ function filterSet(team) { return res; } + that.pp2limit = function(initial) { + var res = initial || ""; + + for (var i in m_list) { + var filter = m_list[i]; + if (!filter.id) { + if (res) res += ","; + res += filter.field + "=" + filter.value.replace(/[\\|,]/g, '\\$&'); + } + } + + return res; + } + + return that; } -- 1.7.10.4