From 751ebc17f7fc7be26613db0a3cdee05fc401318b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Fri, 6 Jun 2014 21:37:28 +0200 Subject: [PATCH] perf(isArray): use native Array.isArray see benchmark: http://jsperf.com/isarray-performance Closes #7735 --- src/Angular.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Angular.js b/src/Angular.js index 7d38957a..a81fe1c9 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -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