Skip to content

Commit ce351e6

Browse files
jakub-bochenskipetebacondarwin
authored andcommitted
docs(angular.copy): clarify corner cases
The behaviour when null or undefined was passed was not clear. The exception thrown when source == destination was not documented. Closes angular#3946
1 parent e4415d2 commit ce351e6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Angular.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,8 @@ function isLeafNode (node) {
598598
* * If no destination is supplied, a copy of the object or array is created.
599599
* * If a destination is provided, all of its elements (for array) or properties (for objects)
600600
* are deleted and then all elements/properties from the source are copied to it.
601-
* * If `source` is not an object or array, `source` is returned.
601+
* * If `source` is not an object or array (inc. `null` and `undefined`), `source` is returned.
602+
* * If `source` is identical to 'destination' an exception will be thrown.
602603
*
603604
* Note: this function is used to augment the Object type in Angular expressions. See
604605
* {@link ng.$filter} for more information about Angular arrays.

0 commit comments

Comments
 (0)