Fixes #707 - correct guard clause in `split` helper.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Mon, 23 Nov 2015 20:24:25 +0000 (20:24 +0000)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Mon, 23 Nov 2015 20:24:25 +0000 (20:24 +0000)
Turns out the case with no separators and a string pattern was never
caught by a guard clause.

Thanks to @alexlamsl for spotting it.

lib/utils/split.js

index 0faf745..178c739 100644 (file)
@@ -2,7 +2,7 @@ function split(value, separator, includeSeparator, openLevel, closeLevel) {
   var withRegex = typeof separator != 'string';
   var hasSeparator = withRegex ?
     separator.test(value) :
-    value.indexOf(separator);
+    value.indexOf(separator) > -1;
 
   if (!hasSeparator)
     return [value];