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.forEach should specify that it will skip inherited properties, and angular.extend should specify that it relies on the former #5180

@clarabstract

Description

@clarabstract

Although filtering by hasOwnProperty is usually desired (and makes objects easier to work with as maps), it is not usually the default. The docs for angular.forEach should specify this.

Along the same lines, angular.extend should mention the same thing just because, again, it's not obvious what the default should be. (jQuery.extend looks identical on the surface but does not filter on hasOwnProperty for example - neither is "more correct", it just needs to be clearly spelled out.)

I also noticed in the code that angular.extend does some additional things to do with maintaining the $$hashKey identity that should probably be mentioned. E.g. angular.extend should be the prefered way of copying objects so said identity works as expected (I don't actually know that's what it does, only had time to skim through).

(As an aside, would be worth bringing up HashMap as a a public API? It looks like it might be a handy way of associating, say, DOM specific data to objects (like controller values) that should ideally remain ignorant of the DOM.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions