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