Ensure _.split works with emojis.

This commit is contained in:
John-David Dalton
2016-04-08 01:03:43 -07:00
parent 23901dfd45
commit e776e679af
2 changed files with 38 additions and 4 deletions

View File

@@ -13560,7 +13560,18 @@
* // => ['a', 'b']
*/
function split(string, separator, limit) {
return toString(string).split(separator, limit);
string = toString(string);
if (string && (
typeof separator == 'string' ||
(separator != null && !isRegExp(separator))
)) {
separator += '';
if (separator == '' && reHasComplexSymbol.test(string)) {
var strSymbols = stringToArray(string);
return limit === undefined ? strSymbols : strSymbols.slice(0, limit < 0 ? 0 : limit);
}
}
return string.split(separator, limit);
}
/**