Skip to content

Commit b0bd1b2

Browse files
committed
Update handling of limit to the current es6 draft.
1 parent 05f25cd commit b0bd1b2

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lodash.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13568,7 +13568,7 @@
1356813568
separator += '';
1356913569
if (separator == '' && reHasComplexSymbol.test(string)) {
1357013570
var strSymbols = stringToArray(string);
13571-
return limit === undefined ? strSymbols : strSymbols.slice(0, limit < 0 ? 0 : limit);
13571+
return limit === undefined ? strSymbols : strSymbols.slice(0, limit >>> 0);
1357213572
}
1357313573
}
1357413574
return string.split(separator, limit);

test/test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23251,7 +23251,7 @@
2325123251
thumbsUp = '\ud83d\udc4d';
2325223252

2325323253
QUnit.test('should account for astral symbols', function(assert) {
23254-
assert.expect(32);
23254+
assert.expect(33);
2325523255

2325623256
var allHearts = _.repeat(hearts, 10),
2325723257
chars = hearts + comboGlyph,
@@ -23274,7 +23274,8 @@
2327423274
assert.strictEqual(_.size(string), 13);
2327523275
assert.deepEqual(_.split(string, ' '), ['A', leafs + ',', comboGlyph + ',', 'and', rocket]);
2327623276
assert.deepEqual(_.split(string, ' ', 3), ['A', leafs + ',', comboGlyph + ',']);
23277-
assert.deepEqual(_.split(string, undefined), string.split(undefined));
23277+
assert.deepEqual(_.split(string, undefined), [string]);
23278+
assert.deepEqual(_.split(string, undefined, -1), [string]);
2327823279
assert.deepEqual(_.split(string, undefined, 0), string.split(undefined, 0));
2327923280

2328023281
var expected = ['A', ' ', leafs, ',', ' ', comboGlyph, ',', ' ', 'a', 'n', 'd', ' ', rocket];

0 commit comments

Comments
 (0)