angular.is[Array, Date, RegExp, File] ignores prototype chain #7143
Description
Dear Angular Team,
angular.isArray
currently uses Object.prototype.toString
to determine if a variable is an Array
which results, for example, in filters such as orderByFilter
ignoring collection classes that inherit properties and methods of Array.prototype
. As well as an added performance impact compared to instanceof
.
Example: http://jsfiddle.net/M3U3g/
Performance Test: http://jsperf.com/instanceof-vs-object-prototype-tostring-angular
Can we please use instanceof
rather than Object.prototype.toString
within angular.isArray
so orderByFilter
and other services work with classes that inherit from Array.prototype
?
It may also be worth considering changing isDate
, isRegExp
and isFile
as well for the performance increase and classes that inherit from those prototypes.