@@ -13,7 +13,7 @@ arr.remove.head(1); // arr.data is now [2,3,4]
13
13
if (arr.notEmpty) arr.prepend([10,11]); // arr.data is now [10,11,2,3,4]
14
14
arr.append([100,200,300]); // arr.data is now [10,11,2,3,4,100,200,300]
15
15
```
16
- To actually see or get the array itself, you must access PublicArray's ` data ` property:
16
+ To actually see or get the array itself, you must access PublicArray's ` . data` property:
17
17
18
18
` console.log(arr.data); // logs '[10,11,2,3,4,100,200,300]' `
19
19
@@ -54,38 +54,42 @@ getPublicArray(array = []): PublicArray
54
54
###### an independent copy of the PublicArray instance
55
55
56
56
#### length: number (read-writable)
57
- ###### length of array
57
+ ###### length of this.data
58
58
59
59
#### isEmpty: boolean (read-only)
60
60
###### true if this.data is empty
61
61
62
62
#### notEmpty: boolean (read-only)
63
63
64
+ #### className: string (read-only)
65
+
66
+ ## Properties with methods
67
+
64
68
#### filter: PublicArrayFilter (read-only)
65
- ###### Has methods that narrow down the content of the array and return the PublicArrayFilter instance:
69
+ ###### Its methods narrow down the content of this.data and return the PublicArrayFilter instance:
66
70
<details >
67
71
<summary >view methods</summary >
68
72
69
73
```
70
74
filter.byTest(testFunction: ((currentValue, currentIndex?, array?) => boolean)): PublicArrayFilter
71
- // Narrows down the array to only the values that pass testFunction.
75
+ // Narrows down this.data to only the values that pass testFunction.
72
76
73
77
filter.byType(
74
78
type: 'number' | 'boolean' | 'string' | 'array' | 'object' | 'function' | 'undefined'
75
79
): PublicArrayFilter
76
- // Narrows down the array to only values that are the specified type.
80
+ // Narrows down this.data to only the values that are the specified type.
77
81
```
78
82
</details >
79
83
80
84
81
85
#### get: PublicArrayGetter (read-only)
82
- ###### Has methods that return items copied from the array . None of them modify the array.
86
+ ###### Has methods that return items copied from this.data . None of them modify the array.
83
87
<details >
84
88
<summary >view methods</summary >
85
89
86
90
```
87
91
get.copy(): any[]
88
- // Returns independent copy of the array .
92
+ // Returns independent copy of this.data .
89
93
90
94
get.byIndex(index): any
91
95
// Returns item identified by passed index. index can be negative or positive.
@@ -458,7 +462,6 @@ sort.shuffle(): PublicArraySorter;
458
462
</details >
459
463
460
464
461
- #### className: string (read-only)
462
465
</details >
463
466
464
467
@@ -561,6 +564,9 @@ runMethod_and_returnThis(
561
564
```
562
565
// changing the array content:
563
566
arr.data = [{prop1: 'yes', prop2: 'no'}, {prop1: 'no', prop2: 'yes'}];
567
+
568
+ // changing the array content without breaking its memory reference:
569
+ arr.set( [ {prop1: 'yes', prop2: 'no'}, {prop1: 'no', prop2: 'yes'} ] );
564
570
```
565
571
566
572
## Performance
0 commit comments