mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
refactor(angular.copy): use array.length=0 to empty arrays
This commit is contained in:
parent
28273b7f1e
commit
6b19e7d527
1 changed files with 1 additions and 3 deletions
|
|
@ -567,9 +567,7 @@ function copy(source, destination){
|
|||
} else {
|
||||
if (source === destination) throw Error("Can't copy equivalent objects or arrays");
|
||||
if (isArray(source)) {
|
||||
while(destination.length) {
|
||||
destination.pop();
|
||||
}
|
||||
destination.length = 0;
|
||||
for ( var i = 0; i < source.length; i++) {
|
||||
destination.push(copy(source[i]));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue