Skip to content

Commit 4df1732

Browse files
author
Steve Thompson
committed
more changes to README
1 parent 5326793 commit 4df1732

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

README.md

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -78,22 +78,6 @@ filter.byType(
7878
</details>
7979

8080

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-
9781
#### get: PublicArrayGetter (read-only)
9882
###### Has methods that return items copied from the array. None of them modify the array.
9983
<details>
@@ -175,6 +159,23 @@ get.byType(
175159
```
176160
</details>
177161

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+
178179

179180
#### getAndRemove: PublicArrayGetterRemover (read-only)
180181
###### Has methods that both remove and return items from the array:
@@ -414,6 +415,10 @@ replace.each(replacementFunction: (currentValue, currentIndex?, array?) => any):
414415
/**********
415416
Loops thru array, passing each item into replacementFunction.
416417
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.
417422
Example:
418423
// this.data is [1,2,3,4,5,6] .
419424
// this.replace.each((item) => {
@@ -504,10 +509,10 @@ allPass(testFunction): boolean
504509
// returns true if all items pass test.
505510
506511
anyPass(testFunction): boolean
507-
// returns true if only 1 value passes.
512+
// returns true if at least 1 item passes.
508513
509514
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.
511516
512517
firstIndexOf(value): number
513518
// returns index of first instance of value in array. If not found, returns -1.

0 commit comments

Comments
 (0)