Skip to content

Commit 1c09eed

Browse files
author
Steve Thompson
committed
more changes to README
1 parent 1751ae2 commit 1c09eed

File tree

1 file changed

+77
-4
lines changed

1 file changed

+77
-4
lines changed

README.md

Lines changed: 77 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,12 @@ getPublicArray(array = []): PublicArray
4949

5050
### Properties
5151

52-
#### className: string (read-only)
52+
#### data: any[] (read-writable)
53+
###### This is the array to be operated on.
5354

5455
#### copy: PublicArray (read-only)
5556
###### an independent copy of the PublicArray instance
5657

57-
#### data: any[] (read-writable)
58-
###### This is the array to be operated on.
59-
6058
#### length: number (read-writable)
6159
###### length of array
6260

@@ -91,6 +89,79 @@ getConverted.each(mappingFunction: ((item, index?, array?) => any)): any[]
9189
```
9290

9391
#### get: PublicArrayGetter (read-only)
92+
###### This has methods that return items copied from the array. None of them modify the array.
93+
```
94+
get.copy(): any[]
95+
// Returns independent copy of the array.
96+
97+
get.byIndex(index): any
98+
// Returns 1 item. index can be negative or positive.
99+
100+
get.byIndexes(indexes): any[]
101+
// indexes can be negative or positive.
102+
103+
get.head(numItems): any[]
104+
// returns numItems from beginning
105+
106+
get.tail(numItems): any[]
107+
// returns numItems from end
108+
109+
get.between(numItemsToIgnoreAtEachEnd): any[]
110+
// Returns middle of array, between numItemsToIgnoreAtEachEnd
111+
112+
get.adjacentAt(startingIndex, numItems): any[]
113+
// Returns adjacent items. startingIndex can be negative or positive.
114+
115+
get.adjacentToValue(info: IAdjacentToValueInfo): any[]
116+
/**************
117+
Returns adjacent items including, or near, a particular value.
118+
Only applies to the first instance of value found in array.
119+
The parameter 'info' is an object that looks like this:
120+
{
121+
value: any except object (the value to search for in the array),
122+
offset: integer (tells function where, in relation to value, to begin selecting adjacent
123+
items to return. If offset is zero, the selection will begin with value.)
124+
howMany: integer greater than zero (it's how many adjacent items to return)
125+
}
126+
Example:
127+
// arr.data is [1,2,3,4,5,6,7,8,9,10]
128+
let numbers = arr.get.adjacentToValue({value:5, offset: -2, howMany:3});
129+
// numbers is now [3,4,5]
130+
***************/
131+
132+
get.allAfterFirst(value: any): any[]
133+
// value cannot be object
134+
135+
get.allBeforeFirst(value: any): any[]
136+
// value cannot be object
137+
138+
get.allAfterLast(value: any): any[]
139+
// value cannot be object
140+
141+
get.allBeforeLast(value: any): any[]
142+
// value cannot be object
143+
144+
get.uniqueItems(): any[]
145+
// returns no duplicates.
146+
147+
get.duplicates(): any[]
148+
// returns every instance of a duplicate, so you may get multiple instances.
149+
150+
get.shuffled(): any[]
151+
// returns new, shuffled version of the array
152+
153+
get.byTest(testFunction: ((currentValue, currentIndex?, array?) => boolean)): IValueIndexPair[]
154+
/***************
155+
Almost exactly like Array.filter(), except it returns array of IValueIndexPairs.
156+
A IValueIndexPair is this object: {value: any, index: integer}
157+
It's both the value filtered by the testFunction and its index.
158+
***************/
159+
160+
get.byType(
161+
type: 'object' | 'array' | 'number' | 'string' | 'boolean' | 'function' | 'undefined'
162+
): IValueIndexPair[]
163+
// For explanation of IValueIndexPair, see explanation of byTest().
164+
```
94165

95166
#### getAndRemove: PublicArrayGetterRemover (read-only)
96167

@@ -102,6 +173,8 @@ getConverted.each(mappingFunction: ((item, index?, array?) => any)): any[]
102173

103174
#### sort: PublicArraySorter (read-only)
104175

176+
#### className: string (read-only)
177+
105178

106179
### Methods
107180

0 commit comments

Comments
 (0)