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