mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 16:17:50 +00:00
Make _.head avoid accessing array when its length is 0.
This commit is contained in:
@@ -7386,10 +7386,9 @@
|
||||
QUnit.test('should return `undefined` when querying empty arrays', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
var array = [];
|
||||
array['-1'] = 1;
|
||||
|
||||
assert.strictEqual(_.head(array), undefined);
|
||||
arrayProto[0] = 1;
|
||||
assert.strictEqual(_.head([]), undefined);
|
||||
arrayProto.length = 0;
|
||||
});
|
||||
|
||||
QUnit.test('should work as an iteratee for methods like `_.map`', function(assert) {
|
||||
|
||||
Reference in New Issue
Block a user