Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 751ebc1

Browse files
sebholsteincaitp
authored andcommitted
perf(isArray): use native Array.isArray
see benchmark: http://jsperf.com/isarray-performance Closes #7735
1 parent 560f008 commit 751ebc1

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/Angular.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -510,10 +510,14 @@ function isDate(value) {
510510
* @param {*} value Reference to check.
511511
* @returns {boolean} True if `value` is an `Array`.
512512
*/
513-
function isArray(value) {
514-
return toString.call(value) === '[object Array]';
515-
}
516-
513+
var isArray = (function() {
514+
if (!isFunction(Array.isArray)) {
515+
return function(value) {
516+
return toString.call(value) === '[object Array]';
517+
};
518+
}
519+
return Array.isArray;
520+
})();
517521

518522
/**
519523
* @ngdoc function

0 commit comments

Comments
 (0)