mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
Update handling of limit to the current es6 draft.
This commit is contained in:
@@ -13568,7 +13568,7 @@
|
||||
separator += '';
|
||||
if (separator == '' && reHasComplexSymbol.test(string)) {
|
||||
var strSymbols = stringToArray(string);
|
||||
return limit === undefined ? strSymbols : strSymbols.slice(0, limit < 0 ? 0 : limit);
|
||||
return limit === undefined ? strSymbols : strSymbols.slice(0, limit >>> 0);
|
||||
}
|
||||
}
|
||||
return string.split(separator, limit);
|
||||
|
||||
@@ -23251,7 +23251,7 @@
|
||||
thumbsUp = '\ud83d\udc4d';
|
||||
|
||||
QUnit.test('should account for astral symbols', function(assert) {
|
||||
assert.expect(32);
|
||||
assert.expect(33);
|
||||
|
||||
var allHearts = _.repeat(hearts, 10),
|
||||
chars = hearts + comboGlyph,
|
||||
@@ -23274,7 +23274,8 @@
|
||||
assert.strictEqual(_.size(string), 13);
|
||||
assert.deepEqual(_.split(string, ' '), ['A', leafs + ',', comboGlyph + ',', 'and', rocket]);
|
||||
assert.deepEqual(_.split(string, ' ', 3), ['A', leafs + ',', comboGlyph + ',']);
|
||||
assert.deepEqual(_.split(string, undefined), string.split(undefined));
|
||||
assert.deepEqual(_.split(string, undefined), [string]);
|
||||
assert.deepEqual(_.split(string, undefined, -1), [string]);
|
||||
assert.deepEqual(_.split(string, undefined, 0), string.split(undefined, 0));
|
||||
|
||||
var expected = ['A', ' ', leafs, ',', ' ', comboGlyph, ',', ' ', 'a', 'n', 'd', ' ', rocket];
|
||||
|
||||
Reference in New Issue
Block a user