mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-02 09:00:34 +08:00
perf(isArray): use native Array.isArray
see benchmark: http://jsperf.com/isarray-performance Closes #7735
This commit is contained in:
committed by
Caitlin Potter
parent
560f00860d
commit
751ebc17f7
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user