Skip to content

Commit 072515c

Browse files
author
Steve Thompson
committed
More additions to README
1 parent b45957f commit 072515c

File tree

3 files changed

+125
-19
lines changed

3 files changed

+125
-19
lines changed

README.md

Lines changed: 107 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ var getPublicArray = require('@writetome51/public-array').getPublicArray;
2121

2222
## Public API
2323

24+
2425
### Instantiation
2526
```
2627
getPublicArray(array = []): PublicArray
@@ -34,13 +35,114 @@ getPublicArray(array = []): PublicArray
3435
### Properties
3536

3637
```
37-
data : any[] (read-writable) // This is the array to be operated on.
38+
className: string (read-only)
39+
40+
copy: PublicArray (read-only) // an independent copy of the PublicArray instance
41+
42+
data: any[] (read-writable) // This is the array to be operated on.
43+
44+
length: number (read-writable) // length of array
45+
46+
isEmpty: boolean (read-only) // true if this.data is empty
47+
48+
notEmpty: boolean (read-only)
49+
50+
filter: PublicArrayFilter (read-only)
51+
52+
getConverted: PublicArrayGetterConverter (read-only)
53+
54+
get: PublicArrayGetter (read-only)
55+
56+
getAndRemove: PublicArrayGetterRemover (read-only)
57+
58+
insert: PublicArrayInserter (read-only)
59+
60+
remove: PublicArrayRemover (read-only)
61+
62+
replace: PublicArrayReplacer (read-only)
63+
64+
sort: PublicArraySorter (read-only)
65+
3866
```
3967

4068
### Methods
4169

4270
```
4371
72+
asString(glue = ', '): string
73+
// Does same thing as Array.join()
74+
75+
has(value): boolean
76+
// returns false if value is object.
77+
78+
hasAll(values: any[]): boolean
79+
// returns false if values contains object.
80+
81+
hasAny(values: any[]): boolean
82+
83+
hasAdjacent(values: any[]): boolean
84+
// returns false if values contains object.
85+
86+
startsWith(values: any[]): boolean
87+
// returns false if values contains object.
88+
89+
endsWith(values: any[]): boolean
90+
// returns false if values contains object.
91+
92+
matches(array): boolean
93+
// returns false if array contains object.
94+
95+
96+
// For the next 3 methods:
97+
// testFunction is a callback with same signature as callback passed to
98+
// Array.filter() :
99+
// testFunction(value, index?, theArray?): checks if value passes test. If yes, it returns true.
100+
101+
102+
// returns true if all items pass test.
103+
allPass(testFunction): boolean
104+
105+
106+
// returns true if only 1 value passes.
107+
anyPass(testFunction): boolean
108+
109+
110+
// returns all indexes of items that pass test.
111+
indexesThatPass(testFunction): number[]
112+
113+
114+
// Does not work if value is object.
115+
firstIndexOf(value): number
116+
117+
118+
// Does not work if value is object.
119+
lastIndexOf(value): number
120+
121+
122+
// Does not work if value is object.
123+
indexesOf(value): number[]
124+
125+
append(values: any[]): this
126+
127+
prepend(values: any[]): this
128+
129+
forEach(iterationFunction): this
130+
// iterationFunction = function(currentItem, currentIndex?, entireArray?){...}
131+
132+
protected _createGetterAndOrSetterForEach(
133+
propertyNames: string[],
134+
configuration: GetterSetterConfiguration
135+
) : void
136+
137+
returnThis_after(voidExpression: any) : this
138+
// Even if voidExpression returns something, the returned data isn't used.
139+
140+
runMethod_and_returnThis(
141+
callingObject,
142+
method: Function,
143+
methodArgs: any[],
144+
additionalAction?
145+
) : this
44146
```
45147

46148

@@ -63,6 +165,10 @@ PublicArrayReplacer instead:
63165
```
64166
let replace = new PublicArrayReplacer(arr);
65167
```
168+
## Inheritance Chain
169+
170+
PublicArray<-PublicArrayContent<-PublicArrayContainer<-BatchGetterSetter<-MethodChainable<-SelfIdentifiable
171+
66172

67173
## License
68174
[MIT](https://choosealicense.com/licenses/mit/)

dist/privy/PublicArray.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ var PublicArray = /** @class */ (function (_super) {
3535
/***************
3636
Public Properties:
3737
38-
readonly copy: PublicArray; // independent copy of this instance.
39-
readonly filter: PublicArrayFilter;
40-
readonly getConverted: PublicArrayGetterConverter;
41-
readonly get: PublicArrayGetter;
42-
readonly getAndRemove: PublicArrayGetterRemover;
43-
readonly insert: PublicArrayInserter;
44-
readonly remove: PublicArrayRemover;
45-
readonly replace: PublicArrayReplacer;
46-
readonly sort: PublicArraySorter;
38+
readonly copy: PublicArray; // independent copy of this instance.
39+
readonly filter: PublicArrayFilter;
40+
readonly getConverted: PublicArrayGetterConverter;
41+
readonly get: PublicArrayGetter;
42+
readonly getAndRemove: PublicArrayGetterRemover;
43+
readonly insert: PublicArrayInserter;
44+
readonly remove: PublicArrayRemover;
45+
readonly replace: PublicArrayReplacer;
46+
readonly sort: PublicArraySorter;
4747
***************/
4848
function PublicArray(
4949
// begin injected dependencies...

lib/privy/PublicArray.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ export class PublicArray extends PublicArrayContent {
3232
/***************
3333
Public Properties:
3434
35-
readonly copy: PublicArray; // independent copy of this instance.
36-
readonly filter: PublicArrayFilter;
37-
readonly getConverted: PublicArrayGetterConverter;
38-
readonly get: PublicArrayGetter;
39-
readonly getAndRemove: PublicArrayGetterRemover;
40-
readonly insert: PublicArrayInserter;
41-
readonly remove: PublicArrayRemover;
42-
readonly replace: PublicArrayReplacer;
43-
readonly sort: PublicArraySorter;
35+
readonly copy: PublicArray; // independent copy of this instance.
36+
readonly filter: PublicArrayFilter;
37+
readonly getConverted: PublicArrayGetterConverter;
38+
readonly get: PublicArrayGetter;
39+
readonly getAndRemove: PublicArrayGetterRemover;
40+
readonly insert: PublicArrayInserter;
41+
readonly remove: PublicArrayRemover;
42+
readonly replace: PublicArrayReplacer;
43+
readonly sort: PublicArraySorter;
4444
***************/
4545

4646

0 commit comments

Comments
 (0)