@@ -78,22 +78,6 @@ filter.byType(
78
78
</details >
79
79
80
80
81
- #### getConverted: PublicArrayGetterConverter (read-only)
82
- ###### Has the Array methods .map() and .reduce() , but renamed to .each() and .toOne() , respectively. None of them modify the array.
83
- <details >
84
- <summary >view methods</summary >
85
-
86
- ```
87
- getConverted.toOne(
88
- reducingFunction: ((previousValue: any, currentValue: any, index?, array?) => any)
89
- ): any
90
- // reduces all values in array down to a single value, and returns that value.
91
-
92
- getConverted.each(mappingFunction: ((item, index?, array?) => any)): any[]
93
- // returns new array where each value in current array is converted into something else.
94
- ```
95
- </details >
96
-
97
81
#### get: PublicArrayGetter (read-only)
98
82
###### Has methods that return items copied from the array. None of them modify the array.
99
83
<details >
@@ -175,6 +159,23 @@ get.byType(
175
159
```
176
160
</details >
177
161
162
+
163
+ #### getConverted: PublicArrayGetterConverter (read-only)
164
+ ###### Has the Array methods .map() and .reduce() , but renamed to .each() and .toOne() , respectively. None of them modify the array.
165
+ <details >
166
+ <summary >view methods</summary >
167
+
168
+ ```
169
+ getConverted.toOne(
170
+ reducingFunction: ((previousValue: any, currentValue: any, index?, array?) => any)
171
+ ): any
172
+ // reduces all values in array down to a single value, and returns that value.
173
+
174
+ getConverted.each(mappingFunction: ((item, index?, array?) => any)): any[]
175
+ // returns new array where each value in current array is converted into something else.
176
+ ```
177
+ </details >
178
+
178
179
179
180
#### getAndRemove: PublicArrayGetterRemover (read-only)
180
181
###### Has methods that both remove and return items from the array:
@@ -414,6 +415,10 @@ replace.each(replacementFunction: (currentValue, currentIndex?, array?) => any):
414
415
/**********
415
416
Loops thru array, passing each item into replacementFunction.
416
417
replacementFunction must return the new value you want to give to that index in the array.
418
+ If you don't want to give a particular index a new value, simply return the value it already
419
+ has.
420
+ Important to remember: even if the currentValue should not be replaced, you still must return
421
+ something, or else that item will become undefined.
417
422
Example:
418
423
// this.data is [1,2,3,4,5,6] .
419
424
// this.replace.each((item) => {
@@ -504,10 +509,10 @@ allPass(testFunction): boolean
504
509
// returns true if all items pass test.
505
510
506
511
anyPass(testFunction): boolean
507
- // returns true if only 1 value passes.
512
+ // returns true if at least 1 item passes.
508
513
509
514
indexesThatPass(testFunction): number[]
510
- // returns all indexes of items that pass test.
515
+ // returns all indexes of items that pass test. If none pass, returns empty array.
511
516
512
517
firstIndexOf(value): number
513
518
// returns index of first instance of value in array. If not found, returns -1.
0 commit comments