Skip to content

Commit cd87b04

Browse files
author
Steve Thompson
committed
Updated README
1 parent 7fdb589 commit cd87b04

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

README.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ new PublicArray(array = [])
6767

6868
Helpful tidbit: These properties all contain their own `.data` property, which always matches `this.data`
6969

70-
#### filter: PublicArrayFilter (read-only)
70+
#### filter: [PublicArrayFilter](https://github.com/writetome51/public-array-filter#publicarrayfilter)
71+
(read-only)
7172
###### Its methods narrow down the content of this.data and return the PublicArrayFilter instance:
7273
<details>
7374
<summary>view methods</summary>
@@ -84,7 +85,8 @@ filter.byType(
8485
</details>
8586

8687

87-
#### get: PublicArrayGetter (read-only)
88+
#### get: [PublicArrayGetter](https://github.com/writetome51/public-array-getter#publicarraygetter)
89+
(read-only)
8890
###### Its methods return items copied from this.data . None of them modify this.data .
8991
<details>
9092
<summary>view methods</summary>
@@ -569,13 +571,18 @@ runMethod_and_returnThis(
569571

570572

571573
## Usage Examples
574+
<details>
575+
<summary>view examples</summary>
572576

573577
```
574578
// changing the array content:
575-
arr.data = [item1, item2, item3, ...];
579+
arr.data = [10,20,30,40];
576580
577581
// 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'
579586
580587
// using .append() instead of .push():
581588
arr.append(['goodbye']); // now last item in arr.data is 'goodbye'
@@ -597,7 +604,15 @@ arr.sort.numbersAscending();
597604
598605
// removing and returning dirty 4-letter words:
599606
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;
600614
```
615+
</details>
601616

602617
## Performance
603618

dist/index.d.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ export declare class PublicArray extends PublicArrayContent {
3030
private _replace;
3131
private _sort;
3232

33-
private __dependencyClasses;
34-
3533

3634
constructor(data?: any[]);
3735

@@ -45,8 +43,8 @@ export declare class PublicArray extends PublicArrayContent {
4543
prepend(values: any[]): this;
4644

4745

48-
forEach(iterationFunction: (currentValue: any, currentIndex?: number, entireArray?: any[]) => any): this;
49-
46+
forEach(
47+
iterationFunction: (currentValue: any, currentIndex?: number, entireArray?: any[]) => any
48+
): this;
5049

51-
private __getInstancePropertyGetter;
5250
}

dist/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var __extends = (this && this.__extends) || (function () {
55
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
66
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
77
return extendStatics(d, b);
8-
};
8+
}
99
return function (d, b) {
1010
extendStatics(d, b);
1111
function __() { this.constructor = d; }

0 commit comments

Comments
 (0)