@@ -67,7 +67,8 @@ new PublicArray(array = [])
67
67
68
68
Helpful tidbit: These properties all contain their own ` .data ` property, which always matches ` this.data `
69
69
70
- #### filter: PublicArrayFilter (read-only)
70
+ #### filter: [ PublicArrayFilter] ( https://github.com/writetome51/public-array-filter#publicarrayfilter )
71
+ (read-only)
71
72
###### Its methods narrow down the content of this.data and return the PublicArrayFilter instance:
72
73
<details >
73
74
<summary >view methods</summary >
@@ -84,7 +85,8 @@ filter.byType(
84
85
</details >
85
86
86
87
87
- #### get: PublicArrayGetter (read-only)
88
+ #### get: [ PublicArrayGetter] ( https://github.com/writetome51/public-array-getter#publicarraygetter )
89
+ (read-only)
88
90
###### Its methods return items copied from this.data . None of them modify this.data .
89
91
<details >
90
92
<summary >view methods</summary >
@@ -569,13 +571,18 @@ runMethod_and_returnThis(
569
571
570
572
571
573
## Usage Examples
574
+ <details >
575
+ <summary >view examples</summary >
572
576
573
577
```
574
578
// changing the array content:
575
- arr.data = [item1, item2, item3, ... ];
579
+ arr.data = [10,20,30,40 ];
576
580
577
581
// changing the array content without breaking its memory reference:
578
- arr.set( [item1, item2, item3, ...] );
582
+ arr.set( [10,20,30,40] );
583
+
584
+ // getting the array contents as a string:
585
+ let str = arr.asString('-'); // str === '10-20-30-40'
579
586
580
587
// using .append() instead of .push():
581
588
arr.append(['goodbye']); // now last item in arr.data is 'goodbye'
@@ -597,7 +604,15 @@ arr.sort.numbersAscending();
597
604
598
605
// removing and returning dirty 4-letter words:
599
606
let dirtyWords = arr.getAndRemove.byTest((item) => isString(item) && item.length === 4);
607
+
608
+ // inserting a new item just before the last item and returning the modified Array:
609
+ arr.insert.at(-2, [newItem]);
610
+ let modifiedArray = arr.data;
611
+
612
+ // You could shorten the previous two lines into this:
613
+ let modifiedArray = arr.insert.at(-2, [newItem]).data;
600
614
```
615
+ </details >
601
616
602
617
## Performance
603
618
0 commit comments