Ensure _.isArray fallback returns a boolean value.

Former-commit-id: c96fb8e95c40d546099796f8337db6d4d3d33aea
This commit is contained in:
John-David Dalton
2013-04-22 23:56:36 -07:00
parent 3ff0a44a1c
commit 6e289339d7
8 changed files with 33 additions and 38 deletions

8
dist/lodash.js vendored
View File

@@ -634,7 +634,9 @@
* _.isArray([1, 2, 3]);
* // => true
*/
var isArray = nativeIsArray;
var isArray = nativeIsArray || function(value) {
return value ? (typeof value == 'object' && toString.call(value) == arrayClass) : false;
};
/**
* A fallback implementation of `Object.keys` which produces an array of the
@@ -1197,7 +1199,7 @@
* // => true
*/
function isDate(value) {
return value ? typeof value == 'object' && toString.call(value) == dateClass : false;
return value ? (typeof value == 'object' && toString.call(value) == dateClass) : false;
}
/**
@@ -1644,7 +1646,7 @@
* // => true
*/
function isRegExp(value) {
return value ? typeof value == 'object' && toString.call(value) == regexpClass : false;
return value ? (typeof value == 'object' && toString.call(value) == regexpClass) : false;
}
/**