aboutsummaryrefslogtreecommitdiffstats
path: root/lib/util.js
diff options
context:
space:
mode:
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);