aboutsummaryrefslogtreecommitdiffstats
path: root/lib/util.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-09-19 00:34:48 +0200
committerMatěj Cepl <mcepl@redhat.com>2010-09-19 00:34:48 +0200
commitc2a09508ae88149e615bd8f393858dd927f491cf (patch)
treea7be1ef25ebb4266f63bd3fc4e07ec02a166b0b2 /lib/util.js
parent88112016166ac10e7ed2848c9562bed211918748 (diff)
downloadbugzilla-triage-c2a09508ae88149e615bd8f393858dd927f491cf.tar.gz
Fix .split() method
Diffstat (limited to 'lib/util.js')
-rw-r--r--lib/util.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/util.js b/lib/util.js
index 88c3457..b258c5f 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -129,7 +129,7 @@ var valToArray = exports.valToArray = function valToArray(val) {
* @return String with merged lists
*/
exports.addCSVValue = function addCSVValue(str, value) {
- var parts = (str.trim().length > 0 ? str.split(/,\s*/) : []);
+ var parts = (str.trim().length > 0 ? str.split(/[,\s]+/) : []);
if (!value) {
return str;
}
@@ -152,8 +152,8 @@ exports.addCSVValue = function addCSVValue(str, value) {
*/
exports.removeCSVValue = function removeCSVValue(str, value) {
str = str.trim();
- var parts = str ? str.split(/,\s*/) : [];
- var valueArr = value instanceof Array ? value : value.split(/,\s*/);
+ var parts = str ? str.split(/[,\s]+/) : [];
+ var valueArr = value instanceof Array ? value : value.split(/[,\s]+/);
parts = parts.filter(function (e, i, a) {
return (!isInList(e, valueArr));
});
@@ -196,7 +196,7 @@ var filterByRegexp = exports.filterByRegexp =
*/
exports.killNodes = function killNodes(doc, target, remove) {
target = target.trim();
- var targetArr = target instanceof Array ? target : target.split(/,\s*/);
+ var targetArr = target instanceof Array ? target : target.split(/[,\s]+/);
targetArr.forEach(function(x) {
if (remove) {
var targetNode = doc.getElementById(x);