Update handling of limit to the current es6 draft.

This commit is contained in:
John-David Dalton
2016-04-08 08:48:29 -07:00
parent ee73c9b436
commit c1958daf65
2 changed files with 4 additions and 3 deletions

View File

@@ -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);

View File

@@ -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];