Skip to content

Commit a6fef5b

Browse files
committed
fix(reverseFilter): issue with using the DOM, #38
1 parent 970ccbf commit a6fef5b

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/_filter/collection/reverse.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,20 @@ angular.module('a8m.reverse', [])
1818
return input.split('').reverse().join('');
1919
}
2020

21-
return (isArray(input)) ? input.reverse() : input;
21+
return (isArray(input)) ? reverseArray(input) : input;
2222
}
2323
}]);
24+
25+
/**
26+
* @description
27+
* Get an array, reverse it manually.
28+
* @param arr
29+
* @returns {Array}
30+
*/
31+
function reverseArray(arr) {
32+
var res = [];
33+
arr.forEach(function(e, i) {
34+
res.push(arr[arr.length - i -1]);
35+
});
36+
return res;
37+
}

0 commit comments

Comments
 (0)