mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 17:37:50 +00:00
Improve compliance with Array methods in ES5 when passed a null value. (ES5 Array methods treat null like [])
This commit is contained in:
@@ -83,6 +83,7 @@ $(document).ready(function() {
|
||||
equals(_.indexOf(numbers, 2), 1, 'can compute indexOf, even without the native function');
|
||||
var result = (function(){ return _.indexOf(arguments, 2); })(1, 2, 3);
|
||||
equals(result, 1, 'works on an arguments object');
|
||||
equals(_.indexOf(null, 2), -1, 'handles nulls properly');
|
||||
});
|
||||
|
||||
test("arrays: lastIndexOf", function() {
|
||||
@@ -92,6 +93,7 @@ $(document).ready(function() {
|
||||
equals(_.lastIndexOf(numbers, 0), 8, 'lastIndexOf the other element');
|
||||
var result = (function(){ return _.lastIndexOf(arguments, 1); })(1, 0, 1, 0, 0, 1, 0, 0, 0);
|
||||
equals(result, 5, 'works on an arguments object');
|
||||
equals(_.indexOf(null, 2), -1, 'handles nulls properly');
|
||||
});
|
||||
|
||||
test("arrays: range", function() {
|
||||
|
||||
Reference in New Issue
Block a user