Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,7 @@
equal(_.size(new String('hello')), 5, 'can compute the size of string object');

equal(_.size(null), 0, 'handles nulls');
equal(_.size(0), 0, 'handles numbers');
});

test('partition', function() {
Expand Down
2 changes: 1 addition & 1 deletion underscore.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
// Related: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
var isArrayLike = function(collection) {
var length = collection && collection.length;
var length = collection != null && collection.length;
return typeof length == 'number' && length >= 0 && length <= MAX_ARRAY_INDEX;
};

Expand Down