refactor(angular.copy): use array.length=0 to empty arrays

This commit is contained in:
Igor Minar 2013-02-08 03:55:34 -08:00
parent 28273b7f1e
commit 6b19e7d527

View file

@ -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]));
}