Skip to content

Commit 1751ae2

Browse files
author
Steve Thompson
committed
More changes to README
1 parent e6c0aeb commit 1751ae2

File tree

1 file changed

+21
-26
lines changed

1 file changed

+21
-26
lines changed

README.md

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -66,35 +66,30 @@ getPublicArray(array = []): PublicArray
6666
#### notEmpty: boolean (read-only)
6767

6868
#### filter: PublicArrayFilter (read-only)
69-
Filter has methods that narrow down the content of the array it contains
70-
and return the class instance.
71-
72-
To instantiate, pass the actual array it will contain into its constructor:
73-
74-
let filter = new PublicArrayFilter( [item1, item2, item3,...] );
75-
76-
You can also reset the array by accessing the class 'data' property:
77-
78-
filter.data = [1,2,3,4,...];
79-
80-
These are all its methods:
81-
82-
// Narrows down the array to only the values that pass test:
83-
84-
byTest(testFunction): this
85-
// testFunction = function(currentValue, currentIndex?, theArray?){...}
86-
// testFunction must return boolean.
87-
88-
89-
// Narrows down the array to only values that are the specified type:
69+
###### This has methods that narrow down the content of the array and return the PublicArrayFilter instance:
70+
```
71+
filter.byTest(testFunction): PublicArrayFilter
72+
// Narrows down the array to only the values that pass testFunction.
73+
// testFunction = function(currentValue, currentIndex?, theArray?): boolean
74+
75+
filter.byType(
76+
type: 'number' | 'boolean' | 'string' | 'array' | 'object' | 'function' | 'undefined'
77+
): PublicArrayFilter
78+
// Narrows down the array to only values that are the specified type.
79+
```
9080

91-
byType(
92-
type: 'number' | 'boolean' | 'string' | 'array' | 'object' | 'function' | 'undefined'
93-
): this
81+
#### getConverted: PublicArrayGetterConverter (read-only)
82+
###### This has the Array methods .map() and .reduce() , but renamed to .each() and .toOne() , respectively. None of them modify the array.
83+
```
84+
getConverted.toOne(
85+
reducingFunction: ((previousValue: any, currentValue: any, index?, array?) => any)
86+
): any
87+
// reduces all values in array down to a single value, and returns that value.
9488
89+
getConverted.each(mappingFunction: ((item, index?, array?) => any)): any[]
90+
// returns new array where each value in current array is converted into something else.
91+
```
9592

96-
#### getConverted: PublicArrayGetterConverter (read-only)
97-
9893
#### get: PublicArrayGetter (read-only)
9994

10095
#### getAndRemove: PublicArrayGetterRemover (read-only)

0 commit comments

Comments
 (0)