Skip to content

Commit dd01c9d

Browse files
author
Steve Thompson
committed
more changes to README
1 parent a740972 commit dd01c9d

File tree

1 file changed

+88
-5
lines changed

1 file changed

+88
-5
lines changed

README.md

Lines changed: 88 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ getPublicArray(array = []): PublicArray
6464
#### notEmpty: boolean (read-only)
6565

6666
#### filter: PublicArrayFilter (read-only)
67-
###### This has methods that narrow down the content of the array and return the PublicArrayFilter instance:
67+
###### Has methods that narrow down the content of the array and return the PublicArrayFilter instance:
6868
```
6969
filter.byTest(testFunction): PublicArrayFilter
7070
// Narrows down the array to only the values that pass testFunction.
@@ -77,7 +77,7 @@ filter.byType(
7777
```
7878

7979
#### getConverted: PublicArrayGetterConverter (read-only)
80-
###### This has the Array methods .map() and .reduce() , but renamed to .each() and .toOne() , respectively. None of them modify the array.
80+
###### Has the Array methods .map() and .reduce() , but renamed to .each() and .toOne() , respectively. None of them modify the array.
8181
```
8282
getConverted.toOne(
8383
reducingFunction: ((previousValue: any, currentValue: any, index?, array?) => any)
@@ -89,7 +89,7 @@ getConverted.each(mappingFunction: ((item, index?, array?) => any)): any[]
8989
```
9090

9191
#### get: PublicArrayGetter (read-only)
92-
###### This has methods that return items copied from the array. None of them modify the array.
92+
###### Has methods that return items copied from the array. None of them modify the array.
9393
```
9494
get.copy(): any[]
9595
// Returns independent copy of the array.
@@ -164,7 +164,7 @@ get.byType(
164164
```
165165

166166
#### getAndRemove: PublicArrayGetterRemover (read-only)
167-
###### This has methods that both remove and return items from the array.
167+
###### Has methods that both remove and return items from the array:
168168
```
169169
getAndRemove.byIndex(index): any
170170
// index can be negative or positive.
@@ -234,8 +234,92 @@ getAndRemove.byType(
234234

235235

236236
#### insert: PublicArrayInserter (read-only)
237+
###### Has methods that increase the length of the array and return the PublicArrayInserter instance:
238+
```
239+
insert.at(index, values: any[]): PublicArrayInserter
240+
// inserts values at index. index can be negative or positive.
241+
242+
insert.middle(values: any[], offset = 0): PublicArrayInserter
243+
// inserts values in middle of the array.
244+
// By default, if the array has odd number of items, values will be inserted just before the
245+
// middle item. If you want to change the insert position, set the optional offset parameter to +
246+
// or - whatever integer you want.
247+
```
237248

238249
#### remove: PublicArrayRemover (read-only)
250+
###### Has methods that all remove items from the array and return the PublicArrayRemover instance:
251+
```
252+
remove.byIndex(index): this
253+
// index can be negative or positive.
254+
255+
remove.byIndexes(indexes): this
256+
// indexes can be negative or positive.
257+
258+
remove.adjacentAt(startingIndex, numItemsToRemove): this
259+
// startingIndex can be negative or positive. Removes adjacent items.
260+
261+
remove.adjacentToValue(info): this
262+
/************
263+
Removes adjacent items including, or near, a particular value.
264+
Only applies to the first instance of value found in array.
265+
The parameter 'info' is an object that looks like this:
266+
{
267+
value: any except object (the value to search for in the array),
268+
offset: integer (tells function where, in relation to value, to begin selecting adjacent
269+
items to remove. If offset is zero, the selection will begin with value.)
270+
howMany: integer greater than zero (it's how many adjacent items to remove)
271+
}
272+
Example:
273+
// arr.data is [1,2,3,4,5,6,7,8,9,10]
274+
arr.remove.adjacentToValue({value:5, offset: -2, howMany:3});
275+
// arr.data is now [1,2,6,7,8,9,10]
276+
*************/
277+
278+
remove.head(numItemsToRemove): this
279+
// Removes numItemsToRemove from array's beginning.
280+
281+
remove.tail(numItemsToRemove): this
282+
// Removes numItemsToRemove from array's end.
283+
284+
remove.between(numItemsToKeepAtEachEnd): this
285+
// Removes everything between numItemsToKeepAtEachEnd.
286+
// i.e., if numItemsToKeepAtEachEnd = 2, then only the first 2 items and last 2 items will remain.
287+
288+
remove.firstOf(value): this
289+
// Removes first instance of value. value cannot be object (that applies to all functions here
290+
// with a parameter called 'value').
291+
292+
remove.firstOfEach(values: any[]): this
293+
// Removes first instance of each value. values cannot contain object (that applies to all functions
294+
// here with a parameter called 'values').
295+
296+
remove.allOf(value): this
297+
// Removes all instances of value.
298+
299+
remove.allOfEach(values: any[]): this
300+
// Removes all instances of each value.
301+
302+
remove.allAfterFirst(value: any): this
303+
// Removes all items after first instance of value.
304+
305+
remove.allBeforeFirst(value: any): this
306+
// Removes all items before first instance of value.
307+
308+
remove.allAfterLast(value): this
309+
// Removes all items after last instance of value.
310+
311+
remove.allBeforeLast(value): this
312+
// Removes all items before last instance of value.
313+
314+
remove.duplicates(): this
315+
316+
remove.byTest(testFunction: (currentItem, currentIndex?, array?) => boolean): this
317+
// if currentItem passes test, it is removed.
318+
319+
remove.byType(
320+
type: 'object' | 'array' | 'number' | 'string' | 'boolean' | 'function' | 'undefined'
321+
): this
322+
```
239323

240324
#### replace: PublicArrayReplacer (read-only)
241325

@@ -247,7 +331,6 @@ getAndRemove.byType(
247331
### Methods
248332

249333
```
250-
251334
asString(glue = ', '): string
252335
// Does same thing as Array.join()
253336

0 commit comments

Comments
 (0)