aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-05-10 19:03:03 +0200
committerMatěj Cepl <mcepl@redhat.com>2010-05-10 19:03:03 +0200
commitbae434a9652e433f058fe9ea7a7b51cc2eb6ca23 (patch)
tree9aefb6ea8c3edcd68cf1b5945763b850c68cbed5
parent0a59cf049b19f7697ae4ef52894f8e0f62c55dc4 (diff)
downloadbugzilla-triage-bae434a9652e433f058fe9ea7a7b51cc2eb6ca23.tar.gz
Fix removeCSVValue function.
-rw-r--r--bugzillaBugTriage.js16
1 files changed, 6 insertions, 10 deletions
diff --git a/bugzillaBugTriage.js b/bugzillaBugTriage.js
index 0c21118..8a4f5f0 100644
--- a/bugzillaBugTriage.js
+++ b/bugzillaBugTriage.js
@@ -301,16 +301,12 @@ hlpr.addCSVValue = function addCSVValue(str, value) {
};
// FIXME rewrite so that it doesn't break Eclipse
-//hlpr.removeCSVValue = function removeCSVValue(str, value) {
-// let parts = (str.trim().length > 0 ? str.split(",") : []);
-// for each (let val in hlpr.valToArray(value)) {
-// let pos = parts.indexOf(val);
-// if (pos > -1) {
-// parts.splice(pos, 1);
-// }
-// }
-// return parts.join(",");
-//};
+hlpr.removeCSVValue = function removeCSVValue(str, value) {
+ str = str.trim(); // we want it trimmed without any questions anyway
+ let parts = str ? str.split(",") : [];
+ parts = parts.filter(function(e,i,a) {return (e != value)});
+ return parts.join(",");
+};
/**
* Check whether an item is member of the list. Idea is just to make long if