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

angular.is[Array, Date, RegExp, File] ignores prototype chain #7143

Closed
@rynz

Description

@rynz

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions