Skip to content

Commit 74e47c0

Browse files
author
Steve Thompson
committed
more changes to README
1 parent ed82324 commit 74e47c0

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ arr.remove.head(1); // arr.data is now [2,3,4]
1313
if (arr.notEmpty) arr.prepend([10,11]); // arr.data is now [10,11,2,3,4]
1414
arr.append([100,200,300]); // arr.data is now [10,11,2,3,4,100,200,300]
1515
```
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:
1717

1818
`console.log(arr.data); // logs '[10,11,2,3,4,100,200,300]' `
1919

@@ -54,38 +54,42 @@ getPublicArray(array = []): PublicArray
5454
###### an independent copy of the PublicArray instance
5555

5656
#### length: number (read-writable)
57-
###### length of array
57+
###### length of this.data
5858

5959
#### isEmpty: boolean (read-only)
6060
###### true if this.data is empty
6161

6262
#### notEmpty: boolean (read-only)
6363

64+
#### className: string (read-only)
65+
66+
## Properties with methods
67+
6468
#### 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:
6670
<details>
6771
<summary>view methods</summary>
6872

6973
```
7074
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.
7276
7377
filter.byType(
7478
type: 'number' | 'boolean' | 'string' | 'array' | 'object' | 'function' | 'undefined'
7579
): 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.
7781
```
7882
</details>
7983

8084

8185
#### 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.
8387
<details>
8488
<summary>view methods</summary>
8589

8690
```
8791
get.copy(): any[]
88-
// Returns independent copy of the array.
92+
// Returns independent copy of this.data .
8993
9094
get.byIndex(index): any
9195
// Returns item identified by passed index. index can be negative or positive.
@@ -458,7 +462,6 @@ sort.shuffle(): PublicArraySorter;
458462
</details>
459463

460464

461-
#### className: string (read-only)
462465
</details>
463466

464467

@@ -561,6 +564,9 @@ runMethod_and_returnThis(
561564
```
562565
// changing the array content:
563566
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'} ] );
564570
```
565571

566572
## Performance

dist/index.d.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@writetome51/public-array",
33
"version": "1.0.0",
4-
"description": "A typescript class with clear method names for manipulating arrays",
4+
"description": "A TypeScript/JavaScript class for general array manipulation",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
77
"scripts": {

0 commit comments

Comments
 (0)