@@ -21,6 +21,7 @@ var getPublicArray = require('@writetome51/public-array').getPublicArray;
21
21
22
22
## Public API
23
23
24
+
24
25
### Instantiation
25
26
```
26
27
getPublicArray(array = []): PublicArray
@@ -34,13 +35,114 @@ getPublicArray(array = []): PublicArray
34
35
### Properties
35
36
36
37
```
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
+
38
66
```
39
67
40
68
### Methods
41
69
42
70
```
43
71
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
44
146
```
45
147
46
148
@@ -63,6 +165,10 @@ PublicArrayReplacer instead:
63
165
```
64
166
let replace = new PublicArrayReplacer(arr);
65
167
```
168
+ ## Inheritance Chain
169
+
170
+ PublicArray<-PublicArrayContent<-PublicArrayContainer<-BatchGetterSetter<-MethodChainable<-SelfIdentifiable
171
+
66
172
67
173
## License
68
174
[ MIT] ( https://choosealicense.com/licenses/mit/ )
0 commit comments