Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f102fb7

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 8a7240d commit f102fb7

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
@@ -578,7 +578,8 @@ function isLeafNode (node) {
578578
* * If no destination is supplied, a copy of the object or array is created.
579579
* * If a destination is provided, all of its elements (for array) or properties (for objects)
580580
* are deleted and then all elements/properties from the source are copied to it.
581-
* * If `source` is not an object or array, `source` is returned.
581+
* * If `source` is not an object or array (inc. `null` and `undefined`), `source` is returned.
582+
* * If `source` is identical to 'destination' an exception will be thrown.
582583
*
583584
* Note: this function is used to augment the Object type in Angular expressions. See
584585
* {@link ng.$filter} for more information about Angular arrays.

0 commit comments

Comments
 (0)