@@ -17,30 +17,9 @@ To actually see or get the array itself, you must access PublicArray's `.data` p
17
17
18
18
` console.log(arr.data); // logs '[10,11,2,3,4,100,200,300]' `
19
19
20
- ## Installation
21
-
22
- You must have npm installed first. Then, in the command line:
23
-
24
- ``` bash
25
- npm install @writetome51/public-array
26
- ```
27
-
28
- ## Loading
29
- ```
30
- // If using TypeScript:
31
- import { PublicArray } from '@writetome51/public-array';
32
- // If using ES5 JavaScript:
33
- var PublicArray = require('@writetome51/public-array').PublicArray;
34
- ```
35
-
36
-
37
- ## Instantiation
20
+ ## Constructor
38
21
```
39
- new PublicArray(array = [])
40
- // Examples:
41
- // let arr = new PublicArray([1,2,3,4,5]);
42
- // Or, instantiate with an empty array:
43
- // let arr = new PublicArray();
22
+ constructor(data? = []) // 'data' becomes the array the class manipulates.
44
23
```
45
24
46
25
## Properties
@@ -525,9 +504,9 @@ startsWith(values: any[]): boolean
525
504
endsWith(values: any[]): boolean
526
505
// returns true if this.data ends with exact sequence of values.
527
506
528
- matches(array ): boolean
529
- // returns true if this.data matches passed array exactly.
530
- // will return false if this.data or passed array contains object.
507
+ matches(values: any[] ): boolean
508
+ // returns true if this.data matches values exactly.
509
+ // will return false if values contains object.
531
510
532
511
// For the next 3 methods:
533
512
// testFunction is a callback with same signature as callback passed to
@@ -570,7 +549,10 @@ forEach(iterationFunction): void
570
549
set(newArray): void
571
550
// Changes value of this.data to newArray without breaking its memory reference.
572
551
// So if there are copies of this.data, the copies will be updated as well.
573
-
552
+ ```
553
+ The methods below are not important to know about in order to use this
554
+ class. They're inherited from [ BaseClass] ( https://github.com/writetome51/typescript-base-class#baseclass ) .
555
+ ```
574
556
protected _createGetterAndOrSetterForEach(
575
557
propertyNames: string[],
576
558
configuration: IGetterSetterConfiguration
@@ -671,7 +653,21 @@ replace.adjacentAt(2, ['just', 'an', 'example']);
671
653
672
654
PublicArray<--[ PublicArrayContent] ( https://github.com/writetome51/public-array-content#publicarraycontent ) <--[ PublicArrayContainer] ( https://github.com/writetome51/public-array-container#publicarraycontainer ) <--[ BaseClass] ( https://github.com/writetome51/typescript-base-class#baseclass )
673
655
656
+ ## Installation
657
+
658
+ You must have npm installed first. Then, in the command line:
659
+
660
+ ``` bash
661
+ npm install @writetome51/public-array
662
+ ```
674
663
664
+ ## Loading
665
+ ```
666
+ // If using TypeScript:
667
+ import { PublicArray } from '@writetome51/public-array';
668
+ // If using ES5 JavaScript:
669
+ var PublicArray = require('@writetome51/public-array').PublicArray;
670
+ ```
675
671
676
672
## License
677
673
[ MIT] ( https://choosealicense.com/licenses/mit/ )
0 commit comments