@@ -51,22 +51,11 @@ function removeClass(elem, className) {
51
51
* Run a callback for every element of an Array.
52
52
* @param {Array<?> } arr - The array to iterate over
53
53
* @param {function(?) } func - The callback
54
- * @param {boolean } [reversed] - Whether to iterate in reverse
55
54
*/
56
- function onEach ( arr , func , reversed ) {
57
- if ( arr && arr . length > 0 ) {
58
- if ( reversed ) {
59
- for ( let i = arr . length - 1 ; i >= 0 ; -- i ) {
60
- if ( func ( arr [ i ] ) ) {
61
- return true ;
62
- }
63
- }
64
- } else {
65
- for ( const elem of arr ) {
66
- if ( func ( elem ) ) {
67
- return true ;
68
- }
69
- }
55
+ function onEach ( arr , func ) {
56
+ for ( const elem of arr ) {
57
+ if ( func ( elem ) ) {
58
+ return true ;
70
59
}
71
60
}
72
61
return false ;
@@ -80,14 +69,12 @@ function onEach(arr, func, reversed) {
80
69
* https://developer.mozilla.org/en-US/docs/Web/API/NodeList
81
70
* @param {NodeList<?>|HTMLCollection<?> } lazyArray - An array to iterate over
82
71
* @param {function(?) } func - The callback
83
- * @param {boolean } [reversed] - Whether to iterate in reverse
84
72
*/
85
73
// eslint-disable-next-line no-unused-vars
86
- function onEachLazy ( lazyArray , func , reversed ) {
74
+ function onEachLazy ( lazyArray , func ) {
87
75
return onEach (
88
76
Array . prototype . slice . call ( lazyArray ) ,
89
- func ,
90
- reversed ) ;
77
+ func ) ;
91
78
}
92
79
93
80
function updateLocalStorage ( name , value ) {
0 commit comments