You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,11 @@
1
1
# orb-array
2
-
*orb-array* aims to simplify common array operations that use functional programming constructs. The usage of map, reduce, filter, fill etc. APIs is often verbose. Our goal is to make their usage *less-verbose*
2
+
The usage of map, reduce, filter, fill etc. APIs is often verbose. *orb-array* aims to make it *less-verbose*.
3
3
4
4
## APIs
5
5
### split
6
-
It splits an array into 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. Following are some examples:
6
+
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:
7
7
```js
8
-
//Default is splitting from the middle.
8
+
//Midway split is the default behavior.
9
9
constitems= [1, 2, 3, 4, 5]
10
10
constpieces=split(items)
11
11
// Output: [[1, 2, 3], [4, 5]]
@@ -32,7 +32,7 @@ const items = fill(5, v => v*2) // v is an item index
32
32
```
33
33
34
34
### zip
35
-
It zips a bunch of arrays together. If the arrays vary in size, the output size is equal to the shortest array.
35
+
It zips arrays together. When the array sizes vary, the output size is equal to the shortest array.
**reduce.o** reduces an array to an object. It supports customizations using key and value functions. In the absence of customizations, key and value are the input array items.
45
+
**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.
46
46
```js
47
47
constitems=range(5)
48
48
consto=reduce.o(items)
@@ -54,7 +54,7 @@ const o = reduce.o(items, {value: v => v + 2})
54
54
// Output: {0:2, 1:3, 2:4, 3:5, 4:6}
55
55
```
56
56
57
-
**reduce.mul* multiplies together the elements of the input array. When the input contains a non-numerical value, the output is **NaN**. The boolean values are converted to their numerical form (0 or 1).
57
+
**reduce.mul** multiplies elements of the input array together. When the input contains a non-numerical value, the output is **NaN**. The boolean values are converted to their numerical form (0 or 1).
0 commit comments