@@ -6,7 +6,7 @@ The main reason you would use PublicArray is if you hate JavaScript's built-in A
6
6
like ` .slice() ` , ` .splice() ` , ` .push() ` , and ` .shift() ` . PublicArray has much clearer and expressive
7
7
method names, and a lot more of them. Examples:
8
8
```
9
- let arr = getPublicArray ([1,2,3,4,5,6]);
9
+ let arr = new PublicArray ([1,2,3,4,5,6]);
10
10
arr.remove.tail(2); // arr.data is now [1,2,3,4]
11
11
arr.remove.head(1); // arr.data is now [2,3,4]
12
12
@@ -28,19 +28,19 @@ npm install @writetome51/public-array
28
28
## Loading
29
29
```
30
30
// If using TypeScript:
31
- import { getPublicArray } from '@writetome51/public-array';
31
+ import { PublicArray } from '@writetome51/public-array';
32
32
// If using ES5 JavaScript:
33
- var getPublicArray = require('@writetome51/public-array').getPublicArray ;
33
+ var PublicArray = require('@writetome51/public-array').PublicArray ;
34
34
```
35
35
36
36
37
37
## Instantiation
38
38
```
39
- getPublicArray (array = []): PublicArray
39
+ new PublicArray (array = [])
40
40
// Examples:
41
- // let arr = getPublicArray ([1,2,3,4,5]);
41
+ // let arr = new PublicArray ([1,2,3,4,5]);
42
42
// Or, instantiate with an empty array:
43
- // let arr = getPublicArray ();
43
+ // let arr = new PublicArray ();
44
44
```
45
45
46
46
## Properties
@@ -579,7 +579,7 @@ arr.set( [item1, item2, item3, ...] );
579
579
580
580
PublicArray has a large number of dependencies. You should keep this in mind when optimizing
581
581
the performance of your app. For example, say your code only uses PublicArray's ` .replace ` property
582
- and nothing else. Since ` .replace ` is an instance of PublicArrayReplacer, you will get a
582
+ and nothing else. Since ` .replace ` is an instance of PublicArrayReplacer, you may get a small
583
583
performance boost if you just instantiate PublicArrayReplacer instead of PublicArray:
584
584
```
585
585
let replace = new PublicArrayReplacer(array);
0 commit comments