perf(isArray): use native Array.isArray

see benchmark: http://jsperf.com/isarray-performance
This commit is contained in:
Sebastian Müller
2014-06-06 21:37:28 +02:00
committed by Caitlin Potter
parent e906aafb0a
commit 6c14fb1eb6

View File

@@ -510,10 +510,14 @@ function isDate(value) {
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is an `Array`.
*/
function isArray(value) {
return toString.call(value) === '[object Array]';
}
var isArray = (function() {
if (!isFunction(Array.isArray)) {
return function(value) {
return toString.call(value) === '[object Array]';
};
}
return Array.isArray;
})();
/**
* @ngdoc function