Skip to content

Commit ebbae2b

Browse files
authored
Added Installation Notes
1 parent 1d44c58 commit ebbae2b

1 file changed

Lines changed: 20 additions & 8 deletions

File tree

README.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
# orb-array
2-
The usage of map, reduce, filter, fill etc. APIs is often verbose. *orb-array* aims to make it *less-verbose*.
2+
The usage of map, reduce, filter, fill etc. APIs is often verbose. *orb-array* aims to make it *less-verbose*.
33

4-
## APIs
5-
### split
4+
# Installation
5+
Browser Installation. The module is exported as *orbarr* global variable.
6+
7+
```html
8+
<script src="https://cdn.jsdelivr.net/npm/orb-array@1.0.0/dist/index.js"></script>
9+
```
10+
11+
Node Installation
12+
```js
13+
npm install orb-array
14+
```
15+
16+
# APIs
17+
## split
618
It splits an array into the specified number of pieces. When the number of pieces is larger than the input size, it creates empty pieces. It always returns the specified number of pieces. Some examples:
719
```js
820
// Midway split is the default behavior.
@@ -17,29 +29,29 @@ const pieces = split(items, 10)
1729
// Output: [[1], [2], [3], [4], [5], [], [], [], [], []]
1830
```
1931

20-
### range
32+
## range
2133
It generates numbers in a given range, starting with 0.
2234
```js
2335
const items = range(5)
2436
// Output: [0, 1, 2, 3, 4]
2537
```
2638

27-
### fill
39+
## fill
2840
It generates a range of values using a function.
2941
```js
3042
const items = fill(5, v => v*2) // v is an item index
3143
// Output: [0, 2, 4, 6, 8]
3244
```
3345

34-
### zip
46+
## zip
3547
It zips arrays together. When the array sizes vary, the output size is equal to the shortest array.
3648
```js
3749
const items = range(5)
3850
const values = range(10)
3951
const zipped = zip(items, values)
4052
// Output: [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4]]
4153
```
42-
### reduce
54+
## reduce
4355
*reduce* support several operations.
4456

4557
**reduce.o** reduces an array to an object. It supports customizations using the key and the value functions. Without customizations, key and value are the input array items.
@@ -66,7 +78,7 @@ const result = reduce.mul([])
6678
// Output: 1
6779
```
6880

69-
### map
81+
## map
7082
*map* supports several operations.
7183

7284
**map.scale** uses the input factor to scale elements.

0 commit comments

Comments
 (0)