mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 07:40:22 +00:00
Add JSDoc for the copy() method
This commit is contained in:
parent
0649009624
commit
7cb7fb91c6
1 changed files with 15 additions and 0 deletions
|
|
@ -205,6 +205,21 @@ function isLeafNode (node) {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies stuff.
|
||||
*
|
||||
* If destination is not provided and source is an object or an array, a copy is created & returned,
|
||||
* otherwise the source is returned.
|
||||
*
|
||||
* If destination is provided, all of its properties will be deleted and if source is an object or
|
||||
* an array, all of its members will be copied into the destination object. Finally the destination
|
||||
* is returned just for kicks.
|
||||
*
|
||||
* @param {*} source The source to be used during copy.
|
||||
* Can be any type including primitives, null and undefined.
|
||||
* @param {(Object|Array)=} destination Optional destination into which the source is copied
|
||||
* @return {*}
|
||||
*/
|
||||
function copy(source, destination){
|
||||
if (!destination) {
|
||||
if (source) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue