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

Skip to content

Commit 43fccf5

Browse files
committed
refactor(angular.copy): use array.length=0 to empty arrays
1 parent a5b3bcf commit 43fccf5

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/Angular.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -567,9 +567,7 @@ function copy(source, destination){
567567
} else {
568568
if (source === destination) throw Error("Can't copy equivalent objects or arrays");
569569
if (isArray(source)) {
570-
while(destination.length) {
571-
destination.pop();
572-
}
570+
destination.length = 0;
573571
for ( var i = 0; i < source.length; i++) {
574572
destination.push(copy(source[i]));
575573
}

0 commit comments

Comments
 (0)