Skip to content

Commit 6e9238d

Browse files
author
Steve Thompson
committed
added more documentation to README concerning restrictions
on using objects.
1 parent 3d86e6c commit 6e9238d

File tree

1 file changed

+74
-39
lines changed

1 file changed

+74
-39
lines changed

README.md

Lines changed: 74 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,12 @@ get.between(numItemsToIgnoreAtEachEnd): any[]
109109
// Returns middle of this.data, between numItemsToIgnoreAtEachEnd
110110
111111
get.adjacentAt(startingIndex, numItemsToGet): any[]
112-
// Returns adjacent items. startingIndex can be negative or positive.
113-
112+
// Returns adjacent items. startingIndex can be negative or positive.
113+
114+
// For all the functions below, the parameter 'value' cannot be object.
115+
// 'object' does not include Arrays. Arrays are OK, as long as they don't
116+
// contain objects.
117+
114118
get.adjacentToValue(info: IAdjacentToValueInfo): any[]
115119
/**************
116120
Returns adjacent items including, or near, a particular value.
@@ -126,9 +130,8 @@ get.adjacentToValue(info: IAdjacentToValueInfo): any[]
126130
// this.data is [1,2,3,4,5,6,7,8,9,10]
127131
let numbers = this.get.adjacentToValue({value:5, offset: -2, howMany:3});
128132
// numbers is now [3,4,5]
129-
***************/
133+
***************/
130134
131-
// For all the functions below, the parameter 'value' cannot be object.
132135
133136
get.allAfterFirst(value): any[]
134137
// returns all items after the first instance of value.
@@ -210,6 +213,10 @@ getAndRemove.between(numItemsToKeepAtEachEnd): any[]
210213
getAndRemove.adjacentAt(startingIndex, numItemsToRemove): any[]
211214
// removes and returns adjacent items. startingIndex can be negative or positive.
212215
216+
// For all the functions below, the parameter 'value' cannot be object.
217+
// 'object' does not include Arrays. Arrays are OK, as long as they don't
218+
// contain objects.
219+
213220
getAndRemove.adjacentToValue(info: IAdjacentToValueInfo): any[]
214221
/********
215222
Removes and returns adjacent items including, or near, a particular value.
@@ -226,8 +233,7 @@ getAndRemove.adjacentToValue(info: IAdjacentToValueInfo): any[]
226233
let numbers = this.getAndRemove.adjacentToValue({value:5, offset: 0, howMany:4});
227234
// numbers is now [5,6,7,8]. this.data is now [1,2,3,4,9,10]
228235
*********/
229-
230-
// For all the functions below, the parameter 'value' cannot be object.
236+
231237
232238
getAndRemove.allAfterFirst(value): any[]
233239
// removes and returns all items after first instance of value
@@ -300,6 +306,24 @@ remove.byIndexes(indexes): PublicArrayRemover
300306
remove.adjacentAt(startingIndex, numItemsToRemove): PublicArrayRemover
301307
// Removes adjacent items. startingIndex can be negative or positive.
302308
309+
remove.head(numItemsToRemove): PublicArrayRemover
310+
// Removes numItemsToRemove from beginning of this.data .
311+
312+
remove.tail(numItemsToRemove): PublicArrayRemover
313+
// Removes numItemsToRemove from end of this.data .
314+
315+
remove.between(numItemsToKeepAtEachEnd): PublicArrayRemover
316+
// Removes everything between numItemsToKeepAtEachEnd.
317+
// i.e., if numItemsToKeepAtEachEnd = 2, then only the first 2 items and last 2 items will remain.
318+
319+
/************
320+
For all the functions below:
321+
Any parameter called 'value' cannot be an object.
322+
Any parameter called 'values' cannot contain an object.
323+
'object' does not include Arrays. Arrays are OK, as long as they don't
324+
contain objects.
325+
************/
326+
303327
remove.adjacentToValue(info: IAdjacentToValueInfo): PublicArrayRemover
304328
/************
305329
Removes adjacent items including, or near, a particular value.
@@ -316,22 +340,7 @@ remove.adjacentToValue(info: IAdjacentToValueInfo): PublicArrayRemover
316340
arr.remove.adjacentToValue({value:5, offset: 1, howMany:2});
317341
// arr.data is now [1,2,3,4,5,8,9,10]
318342
*************/
319-
320-
remove.head(numItemsToRemove): PublicArrayRemover
321-
// Removes numItemsToRemove from beginning of this.data .
322-
323-
remove.tail(numItemsToRemove): PublicArrayRemover
324-
// Removes numItemsToRemove from end of this.data .
325-
326-
remove.between(numItemsToKeepAtEachEnd): PublicArrayRemover
327-
// Removes everything between numItemsToKeepAtEachEnd.
328-
// i.e., if numItemsToKeepAtEachEnd = 2, then only the first 2 items and last 2 items will remain.
329343
330-
/************
331-
For all the functions below:
332-
Any parameter called 'value' cannot be an object.
333-
Any parameter called 'values' cannot contain an object.
334-
************/
335344
336345
remove.firstOf(value): PublicArrayRemover
337346
// Removes first instance of value.
@@ -382,7 +391,20 @@ replace.adjacentAt(startingIndex, newValues: any[]): PublicArrayReplacer
382391
// Replaces adjacent items beginning at startingIndex with newValues.
383392
// Number of adjacent items that are replaced is same as number of items in newValues.
384393
// startingIndex can be negative or positive.
394+
395+
replace.between(numItemsToKeepAtEachEnd, newValues: any[]): PublicArrayReplacer
396+
// Replaces everything between numItemsToKeepAtEachEnd with newValues.
397+
// Example: if this.data is [1,2,3,4,5,6,7] , and you call .between(2, [9,10])
398+
// this.data will be [1,2,9,10,6,7] . It preserves the first 2 items and the last 2.
385399
400+
/************
401+
For all the functions below:
402+
Any parameter called 'value' cannot be an object.
403+
Any parameter called 'values' cannot contain an object.
404+
'object' does not include Arrays. Arrays are OK, as long as they don't
405+
contain objects.
406+
************/
407+
386408
replace.adjacentToValue(info: IAdjacentToValueInfo, newValues: any[]): PublicArrayReplacer
387409
/**********
388410
Replaces adjacent items including, or near a particular value, with newValues.
@@ -400,17 +422,6 @@ replace.adjacentToValue(info: IAdjacentToValueInfo, newValues: any[]): PublicArr
400422
// this.adjacentToValue({value: 5, offset: -1, howMany: 2}, newValues);
401423
// this.data is now [1,2,3,20,30,40,6,7,8]
402424
**********/
403-
404-
replace.between(numItemsToKeepAtEachEnd, newValues: any[]): PublicArrayReplacer
405-
// Replaces everything between numItemsToKeepAtEachEnd with newValues.
406-
// Example: if this.data is [1,2,3,4,5,6,7] , and you call .between(2, [9,10])
407-
// this.data will be [1,2,9,10,6,7] . It preserves the first 2 items and the last 2.
408-
409-
/************
410-
For all the functions below:
411-
Any parameter called 'value' cannot be an object.
412-
Any parameter called 'values' cannot contain an object.
413-
************/
414425
415426
replace.firstOf(value, newValue): PublicArrayReplacer
416427
// Replaces first instance of value with newValue.
@@ -486,6 +497,8 @@ asString(glue = ', '): string
486497
For all the functions below:
487498
Any parameter called 'value' cannot be an object.
488499
Any parameter called 'values' cannot contain an object.
500+
'object' does not include Arrays. Arrays are OK, as long as they don't
501+
contain objects.
489502
************/
490503
491504
has(value): boolean
@@ -549,20 +562,42 @@ set(newArray): void
549562
// Changes value of this.data to newArray without breaking its memory reference.
550563
// So if there are copies of this.data, the copies will be updated as well.
551564
552-
protected _createGetterAndOrSetterForEach(
565+
protected _createGetterAndOrSetterForEach(
553566
propertyNames: string[],
554-
configuration: GetterSetterConfiguration
555-
) : void
567+
configuration: IGetterSetterConfiguration
568+
) : void
569+
/*********************
570+
Use this method when you have a bunch of properties that need getter and/or
571+
setter functions that all do the same thing. You pass in an array of string
572+
names of those properties, and the method attaches the same getter and/or
573+
setter function to each property.
574+
IGetterSetterConfiguration is this object:
575+
{
576+
get_setterFunction?: (
577+
propertyName: string, index?: number, propertyNames?: string[]
578+
) => Function,
579+
// get_setterFunction takes the property name as first argument and
580+
// returns the setter function. The setter function must take one
581+
// parameter and return void.
582+
583+
get_getterFunction?: (
584+
propertyName: string, index?: number, propertyNames?: string[]
585+
) => Function
586+
// get_getterFunction takes the property name as first argument and
587+
// returns the getter function. The getter function must return something.
588+
}
589+
*********************/
590+
556591
557-
returnThis_after(voidExpression: any) : this
558-
// Executes voidExpression and returns this.
592+
protected _returnThis_after(voidExpression: any) : this
593+
// voidExpression is executed, then function returns this.
559594
// Even if voidExpression returns something, the returned data isn't used.
560595
561-
runMethod_and_returnThis(
596+
protected _runMethod_and_returnThis(
562597
callingObject,
563598
method: Function,
564599
methodArgs: any[],
565-
additionalAction?
600+
additionalAction?: Function // takes the result returned by method as an argument.
566601
) : this
567602
```
568603
</details>

0 commit comments

Comments
 (0)