Skip to content

Commit 118b3db

Browse files
author
Steve Thompson
committed
Updated dependencies.
Added getPublicArray() function to simplify instantiation.
1 parent e8301f1 commit 118b3db

14 files changed

+965
-584
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# See http://help.github.com/ignore-files/ for more about ignoring files.
33

44
# compiled output
5-
/dist
65
/tmp
76
/out-tsc
87

OpenArray.js

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

OpenArray.ts

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

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# PublicArray
2+
3+
A TypeScript/JavaScript class for general array manipulation.
4+
5+
## Installation
6+
7+
You must have npm installed first. Then, in the command line:
8+
9+
```bash
10+
npm install @writetome51/public-array
11+
```
12+
13+
## Loading
14+
```
15+
// If using TypeScript:
16+
import {PublicArray} from '@writetome51/public-array';
17+
// If using ES5 JavaScript:
18+
var PublicArray = require('@writetome51/public-array').PublicArray;
19+
```
20+
21+
22+
## Public API
23+
24+
### Constructor
25+
```
26+
new PublicArray(array = [])
27+
```
28+
29+
### Properties
30+
31+
```
32+
data : any[] (read-writable) // This is the array to be operated on.
33+
```
34+
35+
### Methods
36+
37+
```
38+
39+
```
40+
41+
42+
43+
## Usage
44+
45+
```
46+
// getting an instance:
47+
let arr = new PublicArray(['h','e','l','l','o']);
48+
49+
// changing the array content:
50+
arr.data = [1,2,3,4,5,6,7];
51+
52+
```
53+
54+
55+
## License
56+
[MIT](https://choosealicense.com/licenses/mit/)

README.txt

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
The main feature of this package is the OpenArray class. All the other classes were
2-
created mainly to act as dependencies for OpenArray to use.
1+
The main feature of this package is the PublicArray class. All the other classes were
2+
created mainly to act as dependencies for PublicArray to use.
33

4-
The main reason you would use OpenArray is if you hate JavaScript's built-in Array
5-
methods, like .slice(), .splice(), .push(), and .shift(). OpenArray has much clearer
4+
The main reason you would use PublicArray is if you hate JavaScript's built-in Array
5+
methods, like .slice(), .splice(), .push(), and .shift(). PublicArray has much clearer
66
and expressive method names. Examples:
77

8-
let arr = ObjectFactory.getInstance(OpenArray, [ [1,2,3,4,5,6] ]);
8+
let arr = ObjectFactory.getInstance(PublicArray, [ [1,2,3,4,5,6] ]);
99

1010
arr.remove.tail(2); // arr.data is now [1,2,3,4]
1111

@@ -15,43 +15,43 @@ if (arr.notEmpty) arr.prepend([10]); // arr.data is now [10,3,4]
1515

1616
arr.append([100,200,300]); // arr.data is now [10,3,4,100,200,300]
1717

18-
To actually see or get the array itself, you must access OpenArray's data property:
18+
To actually see or get the array itself, you must access PublicArray's data property:
1919

2020
console.log(arr.data); // logs '[10,3,4,100,200,300]'
2121

22-
OpenArray has several injected dependencies, so you need to use ObjectFactory (which is
22+
PublicArray has several injected dependencies, so you need to use ObjectFactory (which is
2323
included by npm) to instantiate it:
2424

25-
let arr = ObjectFactory.getInstance(OpenArray, [ [1,2,3,4,5,6] ]);
25+
let arr = ObjectFactory.getInstance(PublicArray, [ [1,2,3,4,5,6] ]);
2626

27-
Aside from 'data', OpenArray has these public properties, which are all instances of the
27+
Aside from 'data', PublicArray has these public properties, which are all instances of the
2828
other classes in this package:
2929

30-
'filter': instance of OpenArrayFilter
30+
'filter': instance of PublicArrayFilter
3131

32-
'getConverted': instance of OpenArrayGetterConverter
32+
'getConverted': instance of PublicArrayGetterConverter
3333

34-
'get': instance of OpenArrayItemGetter
34+
'get': instance of PublicArrayItemGetter
3535

36-
'getAndRemove': instance of OpenArrayItemGetterRemover
36+
'getAndRemove': instance of PublicArrayItemGetterRemover
3737

38-
'insert': instance of OpenArrayItemInserter
38+
'insert': instance of PublicArrayItemInserter
3939

40-
'remove': instance of OpenArrayItemRemover
40+
'remove': instance of PublicArrayItemRemover
4141

42-
'replace': instance of OpenArrayItemReplacer
42+
'replace': instance of PublicArrayItemReplacer
4343

44-
'sort': instance of OpenArraySorter
44+
'sort': instance of PublicArraySorter
4545

4646
To know what methods each of those properties offer, look at the code of each class.
4747

48-
OpenArray also has these 2 methods:
48+
PublicArray also has these 2 methods:
4949

5050
.append(values)
5151

5252
.prepend(values)
5353

54-
Also, OpenArray inherits from OpenArrayContent, which has many of the basic properties
54+
Also, PublicArray inherits from PublicArrayContent, which has many of the basic properties
5555
and methods you need to understand the array's contents, such as:
5656

5757
length, isEmpty, notEmpty, has(value), hasAll(values), hasAny(values), startsWith(values),

0 commit comments

Comments
 (0)