diff options
| -rw-r--r-- | src/Angular.js | 13 | ||||
| -rw-r--r-- | src/apis.js | 4 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/Angular.js b/src/Angular.js index 39e9b385..2b26c88d 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -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; } } diff --git a/src/apis.js b/src/apis.js index 0038a6e1..306d0ce8 100644 --- a/src/apis.js +++ b/src/apis.js @@ -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 = /^([+|-])?(.*)/; |
