mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-04-11 02:21:00 +00:00
imrove $orderBy performance
This commit is contained in:
parent
2e33e89a77
commit
81dac70e72
2 changed files with 9 additions and 8 deletions
|
|
@ -244,18 +244,17 @@ function copy(source, destination){
|
|||
while(destination.length) {
|
||||
destination.pop();
|
||||
}
|
||||
for ( var i = 0; i < source.length; i++) {
|
||||
destination.push(copy(source[i]));
|
||||
}
|
||||
} else {
|
||||
foreach(destination, function(value, key){
|
||||
delete destination[key];
|
||||
});
|
||||
for ( var key in source) {
|
||||
destination[key] = copy(source[key]);
|
||||
}
|
||||
}
|
||||
foreach(source, function(value, key){
|
||||
destination[key] = value ?
|
||||
( isArray(value) ?
|
||||
copy(value, []) :
|
||||
(isObject(value) ? copy(value, {}) : value)) :
|
||||
value;
|
||||
});
|
||||
return destination;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -190,7 +190,9 @@ var angularArray = {
|
|||
}
|
||||
return 0;
|
||||
};
|
||||
return copy(array).sort(reverse(comparator, descend));
|
||||
var arrayCopy = [];
|
||||
for ( var i = 0; i < array.length; i++) { arrayCopy.push(array[i]); }
|
||||
return arrayCopy.sort(reverse(comparator, descend));
|
||||
},
|
||||
'orderByToggle':function(predicate, attribute) {
|
||||
var STRIP = /^([+|-])?(.*)/;
|
||||
|
|
|
|||
Loading…
Reference in a new issue