mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 01:17:50 +00:00
Ensure _.split works with emojis.
This commit is contained in:
13
lodash.js
13
lodash.js
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user