functionalscript 0.0.162 → 0.0.163
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/async/iterable/index.js +4 -0
- package/iterable/index.js +17 -13
- package/package.json +1 -1
package/async/iterable/index.js
CHANGED
|
@@ -90,6 +90,8 @@ const apply = ({ merge, init, result }) => async c => result(await reduce(merge)
|
|
|
90
90
|
|
|
91
91
|
const sum = apply(mapReduce.sum)
|
|
92
92
|
|
|
93
|
+
const join = pipe(mapReduce.join)(apply)
|
|
94
|
+
|
|
93
95
|
module.exports = {
|
|
94
96
|
/** @readonly */
|
|
95
97
|
apply,
|
|
@@ -106,6 +108,8 @@ module.exports = {
|
|
|
106
108
|
/** @readonly */
|
|
107
109
|
sum,
|
|
108
110
|
/** @readonly */
|
|
111
|
+
join,
|
|
112
|
+
/** @readonly */
|
|
109
113
|
exclusiveScan,
|
|
110
114
|
/** @readonly */
|
|
111
115
|
inclusiveScan,
|
package/iterable/index.js
CHANGED
|
@@ -13,6 +13,19 @@ const reduce = merge => init => c => {
|
|
|
13
13
|
/** @type {<I, S, R>(op: mr.Operation<I, S, R>) => (_: Iterable<I>) => R} */
|
|
14
14
|
const apply = ({ merge, init, result }) => pipe(reduce(merge)(init))(result)
|
|
15
15
|
|
|
16
|
+
const sum = apply(mr.sum)
|
|
17
|
+
|
|
18
|
+
const join = pipe(mr.join)(apply)
|
|
19
|
+
|
|
20
|
+
/** @type {<T, R>(f: (value: T) => R) => (c: Iterable<T>) => Iterable<R>} */
|
|
21
|
+
const map = f => c => ({
|
|
22
|
+
*[Symbol.iterator]() {
|
|
23
|
+
for (const i of c) {
|
|
24
|
+
yield f(i)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
|
|
16
29
|
module.exports = {
|
|
17
30
|
/** @readonly */
|
|
18
31
|
apply,
|
|
@@ -21,22 +34,13 @@ module.exports = {
|
|
|
21
34
|
reduce,
|
|
22
35
|
|
|
23
36
|
/** @readonly */
|
|
24
|
-
join
|
|
37
|
+
join,
|
|
25
38
|
|
|
26
39
|
/** @readonly */
|
|
27
|
-
sum
|
|
40
|
+
sum,
|
|
28
41
|
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
* @type {<T, R>(f: (value: T) => R) => (c: Iterable<T>) => Iterable<R>}
|
|
32
|
-
*/
|
|
33
|
-
map: f => c => ({
|
|
34
|
-
*[Symbol.iterator]() {
|
|
35
|
-
for (const i of c) {
|
|
36
|
-
yield f(i)
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}),
|
|
42
|
+
/** @readonly */
|
|
43
|
+
map,
|
|
40
44
|
|
|
41
45
|
/**
|
|
42
46
|
* @readonly
|