From 004e77e63ee1fb0582d2f94c96d7908395b4d8f8 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 --- src/Angular.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Angular.js b/src/Angular.js index 11ce5cf5be1a..ae1d0f9ff5a3 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -482,10 +482,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