rubico 2.4.1 → 2.5.0
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/README.md +9 -0
- package/_internal/mapMapSeries.js +62 -0
- package/_internal/objectForEachSeries.js +6 -4
- package/_internal/objectMapSeries.js +61 -0
- package/_internal/setAdd.js +14 -0
- package/_internal/setMapSeries.js +61 -0
- package/_internal/stringMap.js +1 -1
- package/_internal/stringMapSeries.js +31 -0
- package/dist/Transducer.es.js +1 -1
- package/dist/Transducer.es.min.js +2 -2
- package/dist/Transducer.js +1 -1
- package/dist/Transducer.min.js +1 -1
- package/dist/Transducer.mjs +1 -1
- package/dist/__.es.js +1 -1
- package/dist/__.es.min.js +1 -1
- package/dist/__.js +1 -1
- package/dist/__.min.js +1 -1
- package/dist/__.mjs +1 -1
- package/dist/all.es.js +1 -1
- package/dist/all.es.min.js +2 -2
- package/dist/all.js +1 -1
- package/dist/all.min.js +2 -2
- package/dist/all.mjs +1 -1
- package/dist/always.es.js +1 -1
- package/dist/always.es.min.js +1 -1
- package/dist/always.js +1 -1
- package/dist/always.min.js +1 -1
- package/dist/always.mjs +1 -1
- package/dist/and.es.js +1 -1
- package/dist/and.es.min.js +2 -2
- package/dist/and.js +1 -1
- package/dist/and.min.js +2 -2
- package/dist/and.mjs +1 -1
- package/dist/assign.es.js +1 -1
- package/dist/assign.es.min.js +2 -2
- package/dist/assign.js +1 -1
- package/dist/assign.min.js +1 -1
- package/dist/assign.mjs +1 -1
- package/dist/compose.es.js +1 -1
- package/dist/compose.es.min.js +2 -2
- package/dist/compose.js +1 -1
- package/dist/compose.min.js +1 -1
- package/dist/compose.mjs +1 -1
- package/dist/curry.es.js +1 -1
- package/dist/curry.es.min.js +1 -1
- package/dist/curry.js +1 -1
- package/dist/curry.min.js +1 -1
- package/dist/curry.mjs +1 -1
- package/dist/eq.es.js +1 -1
- package/dist/eq.es.min.js +1 -1
- package/dist/eq.js +1 -1
- package/dist/eq.min.js +1 -1
- package/dist/eq.mjs +1 -1
- package/dist/every.es.js +1 -1
- package/dist/every.es.min.js +1 -1
- package/dist/every.js +1 -1
- package/dist/every.min.js +1 -1
- package/dist/every.mjs +1 -1
- package/dist/filter.es.js +1 -1
- package/dist/filter.es.min.js +1 -1
- package/dist/filter.js +1 -1
- package/dist/filter.min.js +1 -1
- package/dist/filter.mjs +1 -1
- package/dist/flatMap.es.js +1 -1
- package/dist/flatMap.es.min.js +2 -2
- package/dist/flatMap.js +1 -1
- package/dist/flatMap.min.js +1 -1
- package/dist/flatMap.mjs +1 -1
- package/dist/forEach.es.js +9 -7
- package/dist/forEach.es.min.js +2 -2
- package/dist/forEach.js +9 -7
- package/dist/forEach.min.js +2 -2
- package/dist/forEach.mjs +9 -7
- package/dist/get.es.js +1 -1
- package/dist/get.es.min.js +2 -2
- package/dist/get.js +1 -1
- package/dist/get.min.js +1 -1
- package/dist/get.mjs +1 -1
- package/dist/gt.es.js +1 -1
- package/dist/gt.es.min.js +1 -1
- package/dist/gt.js +1 -1
- package/dist/gt.min.js +1 -1
- package/dist/gt.mjs +1 -1
- package/dist/gte.es.js +1 -1
- package/dist/gte.es.min.js +1 -1
- package/dist/gte.js +1 -1
- package/dist/gte.min.js +1 -1
- package/dist/gte.mjs +1 -1
- package/dist/lt.es.js +1 -1
- package/dist/lt.es.min.js +1 -1
- package/dist/lt.js +1 -1
- package/dist/lt.min.js +1 -1
- package/dist/lt.mjs +1 -1
- package/dist/lte.es.js +1 -1
- package/dist/lte.es.min.js +1 -1
- package/dist/lte.js +1 -1
- package/dist/lte.min.js +1 -1
- package/dist/lte.mjs +1 -1
- package/dist/map.es.js +163 -9
- package/dist/map.es.min.js +2 -2
- package/dist/map.js +163 -9
- package/dist/map.min.js +2 -2
- package/dist/map.mjs +163 -9
- package/dist/not.es.js +1 -1
- package/dist/not.es.min.js +2 -2
- package/dist/not.js +1 -1
- package/dist/not.min.js +2 -2
- package/dist/not.mjs +1 -1
- package/dist/omit.es.js +1 -1
- package/dist/omit.es.min.js +2 -2
- package/dist/omit.js +1 -1
- package/dist/omit.min.js +1 -1
- package/dist/omit.mjs +1 -1
- package/dist/or.es.js +1 -1
- package/dist/or.es.min.js +2 -2
- package/dist/or.js +1 -1
- package/dist/or.min.js +2 -2
- package/dist/or.mjs +1 -1
- package/dist/pick.es.js +1 -1
- package/dist/pick.es.min.js +2 -2
- package/dist/pick.js +1 -1
- package/dist/pick.min.js +1 -1
- package/dist/pick.mjs +1 -1
- package/dist/pipe.es.js +1 -1
- package/dist/pipe.es.min.js +2 -2
- package/dist/pipe.js +1 -1
- package/dist/pipe.min.js +1 -1
- package/dist/pipe.mjs +1 -1
- package/dist/reduce.es.js +1 -1
- package/dist/reduce.es.min.js +2 -2
- package/dist/reduce.js +1 -1
- package/dist/reduce.min.js +1 -1
- package/dist/reduce.mjs +1 -1
- package/dist/rubico.es.js +167 -19
- package/dist/rubico.es.min.js +2 -2
- package/dist/rubico.global.js +167 -19
- package/dist/rubico.global.min.js +2 -2
- package/dist/rubico.js +167 -19
- package/dist/rubico.min.js +2 -2
- package/dist/rubico.mjs +167 -19
- package/dist/set.es.js +1 -1
- package/dist/set.es.min.js +1 -1
- package/dist/set.js +1 -1
- package/dist/set.min.js +1 -1
- package/dist/set.mjs +1 -1
- package/dist/some.es.js +1 -1
- package/dist/some.es.min.js +1 -1
- package/dist/some.js +1 -1
- package/dist/some.min.js +1 -1
- package/dist/some.mjs +1 -1
- package/dist/switchCase.es.js +1 -1
- package/dist/switchCase.es.min.js +2 -2
- package/dist/switchCase.js +1 -1
- package/dist/switchCase.min.js +1 -1
- package/dist/switchCase.mjs +1 -1
- package/dist/tap.es.js +1 -1
- package/dist/tap.es.min.js +2 -2
- package/dist/tap.js +1 -1
- package/dist/tap.min.js +2 -2
- package/dist/tap.mjs +1 -1
- package/dist/thunkify.es.js +1 -1
- package/dist/thunkify.es.min.js +2 -2
- package/dist/thunkify.js +1 -1
- package/dist/thunkify.min.js +1 -1
- package/dist/thunkify.mjs +1 -1
- package/dist/transform.es.js +1 -1
- package/dist/transform.es.min.js +2 -2
- package/dist/transform.js +1 -1
- package/dist/transform.min.js +1 -1
- package/dist/transform.mjs +1 -1
- package/dist/tryCatch.es.js +1 -1
- package/dist/tryCatch.es.min.js +1 -1
- package/dist/tryCatch.js +1 -1
- package/dist/tryCatch.min.js +1 -1
- package/dist/tryCatch.mjs +1 -1
- package/dist/x/append.es.js +1 -1
- package/dist/x/append.es.min.js +1 -1
- package/dist/x/append.js +1 -1
- package/dist/x/append.min.js +1 -1
- package/dist/x/append.mjs +1 -1
- package/dist/x/callProp.es.js +1 -1
- package/dist/x/callProp.es.min.js +1 -1
- package/dist/x/callProp.js +1 -1
- package/dist/x/callProp.min.js +1 -1
- package/dist/x/callProp.mjs +1 -1
- package/dist/x/defaultsDeep.es.js +1 -1
- package/dist/x/defaultsDeep.es.min.js +1 -1
- package/dist/x/defaultsDeep.js +1 -1
- package/dist/x/defaultsDeep.min.js +1 -1
- package/dist/x/defaultsDeep.mjs +1 -1
- package/dist/x/differenceWith.es.js +1 -1
- package/dist/x/differenceWith.es.min.js +2 -2
- package/dist/x/differenceWith.js +1 -1
- package/dist/x/differenceWith.min.js +1 -1
- package/dist/x/differenceWith.mjs +1 -1
- package/dist/x/filterOut.es.js +1 -1
- package/dist/x/filterOut.es.min.js +2 -2
- package/dist/x/filterOut.js +1 -1
- package/dist/x/filterOut.min.js +2 -2
- package/dist/x/filterOut.mjs +1 -1
- package/dist/x/find.es.js +1 -1
- package/dist/x/find.es.min.js +1 -1
- package/dist/x/find.js +1 -1
- package/dist/x/find.min.js +1 -1
- package/dist/x/find.mjs +1 -1
- package/dist/x/findIndex.es.js +1 -1
- package/dist/x/findIndex.es.min.js +2 -2
- package/dist/x/findIndex.js +1 -1
- package/dist/x/findIndex.min.js +1 -1
- package/dist/x/findIndex.mjs +1 -1
- package/dist/x/first.es.js +1 -1
- package/dist/x/first.es.min.js +1 -1
- package/dist/x/first.js +1 -1
- package/dist/x/first.min.js +1 -1
- package/dist/x/first.mjs +1 -1
- package/dist/x/flatten.es.js +1 -1
- package/dist/x/flatten.es.min.js +2 -2
- package/dist/x/flatten.js +1 -1
- package/dist/x/flatten.min.js +1 -1
- package/dist/x/flatten.mjs +1 -1
- package/dist/x/groupBy.es.js +1 -1
- package/dist/x/groupBy.es.min.js +2 -2
- package/dist/x/groupBy.js +1 -1
- package/dist/x/groupBy.min.js +1 -1
- package/dist/x/groupBy.mjs +1 -1
- package/dist/x/has.es.js +1 -1
- package/dist/x/has.es.min.js +1 -1
- package/dist/x/has.js +1 -1
- package/dist/x/has.min.js +1 -1
- package/dist/x/has.mjs +1 -1
- package/dist/x/identity.es.js +1 -1
- package/dist/x/identity.es.min.js +1 -1
- package/dist/x/identity.js +1 -1
- package/dist/x/identity.min.js +1 -1
- package/dist/x/identity.mjs +1 -1
- package/dist/x/includes.es.js +1 -1
- package/dist/x/includes.es.min.js +2 -2
- package/dist/x/includes.js +1 -1
- package/dist/x/includes.min.js +1 -1
- package/dist/x/includes.mjs +1 -1
- package/dist/x/isDeepEqual.es.js +1 -1
- package/dist/x/isDeepEqual.es.min.js +2 -2
- package/dist/x/isDeepEqual.js +1 -1
- package/dist/x/isDeepEqual.min.js +1 -1
- package/dist/x/isDeepEqual.mjs +1 -1
- package/dist/x/isEmpty.es.js +1 -1
- package/dist/x/isEmpty.es.min.js +1 -1
- package/dist/x/isEmpty.js +1 -1
- package/dist/x/isEmpty.min.js +1 -1
- package/dist/x/isEmpty.mjs +1 -1
- package/dist/x/isEqual.es.js +1 -1
- package/dist/x/isEqual.es.min.js +1 -1
- package/dist/x/isEqual.js +1 -1
- package/dist/x/isEqual.min.js +1 -1
- package/dist/x/isEqual.mjs +1 -1
- package/dist/x/isFunction.es.js +1 -1
- package/dist/x/isFunction.es.min.js +1 -1
- package/dist/x/isFunction.js +1 -1
- package/dist/x/isFunction.min.js +1 -1
- package/dist/x/isFunction.mjs +1 -1
- package/dist/x/isIn.es.js +1 -1
- package/dist/x/isIn.es.min.js +2 -2
- package/dist/x/isIn.js +1 -1
- package/dist/x/isIn.min.js +1 -1
- package/dist/x/isIn.mjs +1 -1
- package/dist/x/isObject.es.js +1 -1
- package/dist/x/isObject.es.min.js +1 -1
- package/dist/x/isObject.js +1 -1
- package/dist/x/isObject.min.js +1 -1
- package/dist/x/isObject.mjs +1 -1
- package/dist/x/isString.es.js +1 -1
- package/dist/x/isString.es.min.js +1 -1
- package/dist/x/isString.js +1 -1
- package/dist/x/isString.min.js +1 -1
- package/dist/x/isString.mjs +1 -1
- package/dist/x/keys.es.js +1 -1
- package/dist/x/keys.es.min.js +1 -1
- package/dist/x/keys.js +1 -1
- package/dist/x/keys.min.js +1 -1
- package/dist/x/keys.mjs +1 -1
- package/dist/x/last.es.js +1 -1
- package/dist/x/last.es.min.js +1 -1
- package/dist/x/last.js +1 -1
- package/dist/x/last.min.js +1 -1
- package/dist/x/last.mjs +1 -1
- package/dist/x/maxBy.es.js +1 -1
- package/dist/x/maxBy.es.min.js +2 -2
- package/dist/x/maxBy.js +1 -1
- package/dist/x/maxBy.min.js +1 -1
- package/dist/x/maxBy.mjs +1 -1
- package/dist/x/noop.es.js +1 -1
- package/dist/x/noop.es.min.js +1 -1
- package/dist/x/noop.js +1 -1
- package/dist/x/noop.min.js +1 -1
- package/dist/x/noop.mjs +1 -1
- package/dist/x/pluck.es.js +163 -9
- package/dist/x/pluck.es.min.js +2 -2
- package/dist/x/pluck.js +163 -9
- package/dist/x/pluck.min.js +2 -2
- package/dist/x/pluck.mjs +163 -9
- package/dist/x/prepend.es.js +1 -1
- package/dist/x/prepend.es.min.js +1 -1
- package/dist/x/prepend.js +1 -1
- package/dist/x/prepend.min.js +1 -1
- package/dist/x/prepend.mjs +1 -1
- package/dist/x/size.es.js +1 -1
- package/dist/x/size.es.min.js +1 -1
- package/dist/x/size.js +1 -1
- package/dist/x/size.min.js +1 -1
- package/dist/x/size.mjs +1 -1
- package/dist/x/trace.es.js +1 -1
- package/dist/x/trace.es.min.js +2 -2
- package/dist/x/trace.js +1 -1
- package/dist/x/trace.min.js +2 -2
- package/dist/x/trace.mjs +1 -1
- package/dist/x/unionWith.es.js +1 -1
- package/dist/x/unionWith.es.min.js +1 -1
- package/dist/x/unionWith.js +1 -1
- package/dist/x/unionWith.min.js +1 -1
- package/dist/x/unionWith.mjs +1 -1
- package/dist/x/uniq.es.js +1 -1
- package/dist/x/uniq.es.min.js +1 -1
- package/dist/x/uniq.js +1 -1
- package/dist/x/uniq.min.js +1 -1
- package/dist/x/uniq.mjs +1 -1
- package/dist/x/unless.es.js +1 -1
- package/dist/x/unless.es.min.js +2 -2
- package/dist/x/unless.js +1 -1
- package/dist/x/unless.min.js +1 -1
- package/dist/x/unless.mjs +1 -1
- package/dist/x/values.es.js +1 -1
- package/dist/x/values.es.min.js +1 -1
- package/dist/x/values.js +1 -1
- package/dist/x/values.min.js +1 -1
- package/dist/x/values.mjs +1 -1
- package/dist/x/when.es.js +1 -1
- package/dist/x/when.es.min.js +2 -2
- package/dist/x/when.js +1 -1
- package/dist/x/when.min.js +1 -1
- package/dist/x/when.mjs +1 -1
- package/es.js +167 -19
- package/forEach.js +2 -2
- package/index.js +167 -19
- package/map.js +62 -7
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -234,6 +234,12 @@ For advanced asynchronous use cases, some of the methods have property functions
|
|
|
234
234
|
|
|
235
235
|
For more functions beyond the core methods, please visit `rubico/x`. You can find the full documentation at [rubico.land/docs](https://rubico.land/docs).
|
|
236
236
|
|
|
237
|
+
# Benchmarks
|
|
238
|
+
Please find the published benchmark output inside the [benchmark-output](https://github.com/a-synchronous/rubico/tree/master/benchmark-output) folder. You can run the benchmarks on your own system with the following command:
|
|
239
|
+
```
|
|
240
|
+
npm run bench
|
|
241
|
+
```
|
|
242
|
+
|
|
237
243
|
# Contributing
|
|
238
244
|
Your feedback and contributions are welcome. If you have a suggestion, please raise an issue. Prior to that, please search through the issues first in case your suggestion has been made already. If you decide to work on an issue, or feel like taking initiative and contributing anything at all, feel free to create a pull request and I will get back to you shortly.
|
|
239
245
|
|
|
@@ -259,3 +265,6 @@ rubico is [MIT Licensed](https://github.com/a-synchronous/rubico/blob/master/LIC
|
|
|
259
265
|
[Practical Functional Programming in JavaScript - Techniques for Composing Data](https://dev.to/richytong/practical-functional-programming-in-javascript-techniques-for-composing-data-c39)
|
|
260
266
|
<br>
|
|
261
267
|
[Practical Functional Programming in JavaScript - Error Handling](https://dev.to/richytong/practical-functional-programming-in-javascript-error-handling-8g5)
|
|
268
|
+
|
|
269
|
+
# Blog
|
|
270
|
+
Check out the rubico blog at [https://rubico.land/blog](https://rubico.land/blog)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const isPromise = require('./isPromise')
|
|
2
|
+
const curry3 = require('./curry3')
|
|
3
|
+
const thunkify3 = require('./thunkify3')
|
|
4
|
+
const mapSet = require('./mapSet')
|
|
5
|
+
const funcConcat = require('./funcConcat')
|
|
6
|
+
const symbolIterator = require('./symbolIterator')
|
|
7
|
+
|
|
8
|
+
// _mapMapSeriesAsync(
|
|
9
|
+
// iterator Iterator,
|
|
10
|
+
// f function,
|
|
11
|
+
// result Map,
|
|
12
|
+
// ) -> Promise<Map>
|
|
13
|
+
const _mapMapSeriesAsync = async function (iterator, f, result) {
|
|
14
|
+
let iteration = iterator.next()
|
|
15
|
+
while (!iteration.done) {
|
|
16
|
+
let resultItem = f(iteration.value[1])
|
|
17
|
+
if (isPromise(resultItem)) {
|
|
18
|
+
resultItem = await resultItem
|
|
19
|
+
}
|
|
20
|
+
result.set(iteration.value[0], resultItem)
|
|
21
|
+
iteration = iterator.next()
|
|
22
|
+
}
|
|
23
|
+
return result
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @name mapMapSeries
|
|
28
|
+
*
|
|
29
|
+
* @synopsis
|
|
30
|
+
* ```coffeescript [specscript]
|
|
31
|
+
* type MapMapper = (
|
|
32
|
+
* value any,
|
|
33
|
+
* key any,
|
|
34
|
+
* map Map
|
|
35
|
+
* )=>(resultItem Promise|any)
|
|
36
|
+
*
|
|
37
|
+
* mapMapSeries(map Map, f MapMapper) -> Promise|Map
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @description
|
|
41
|
+
* Apply a mapper in series to each value of a Map, returning a new Map of mapped items. Mapper may be asynchronous.
|
|
42
|
+
*/
|
|
43
|
+
const mapMapSeries = function (map, f) {
|
|
44
|
+
const result = new Map()
|
|
45
|
+
const iterator = map[symbolIterator]()
|
|
46
|
+
let iteration = iterator.next()
|
|
47
|
+
while (!iteration.done) {
|
|
48
|
+
const key = iteration.value[0]
|
|
49
|
+
const resultItem = f(iteration.value[1])
|
|
50
|
+
if (isPromise(resultItem)) {
|
|
51
|
+
return resultItem.then(funcConcat(
|
|
52
|
+
curry3(mapSet, result, key, __),
|
|
53
|
+
thunkify3(_mapMapSeriesAsync, iterator, f, result),
|
|
54
|
+
))
|
|
55
|
+
}
|
|
56
|
+
result.set(key, resultItem)
|
|
57
|
+
iteration = iterator.next()
|
|
58
|
+
}
|
|
59
|
+
return result
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
module.exports = mapMapSeries
|
|
@@ -4,11 +4,11 @@ const thunkify3 = require('./thunkify3')
|
|
|
4
4
|
// _objectForEachSeriesAsync(
|
|
5
5
|
// object Object,
|
|
6
6
|
// callback function,
|
|
7
|
-
//
|
|
7
|
+
// doneKeys Object,
|
|
8
8
|
// ) -> Promise<object>
|
|
9
|
-
const _objectForEachSeriesAsync = async function (object, callback,
|
|
9
|
+
const _objectForEachSeriesAsync = async function (object, callback, doneKeys) {
|
|
10
10
|
for (const key in object) {
|
|
11
|
-
if (key
|
|
11
|
+
if (key in doneKeys) {
|
|
12
12
|
continue
|
|
13
13
|
}
|
|
14
14
|
const operation = callback(object[key])
|
|
@@ -31,11 +31,13 @@ const _objectForEachSeriesAsync = async function (object, callback, firstKey) {
|
|
|
31
31
|
* Execute a callback for each value of an object. Return a promise if any executions are asynchronous.
|
|
32
32
|
*/
|
|
33
33
|
const objectForEachSeries = function (object, callback) {
|
|
34
|
+
const doneKeys = {}
|
|
34
35
|
for (const key in object) {
|
|
36
|
+
doneKeys[key] = true
|
|
35
37
|
const operation = callback(object[key])
|
|
36
38
|
if (isPromise(operation)) {
|
|
37
39
|
return operation
|
|
38
|
-
.then(thunkify3(_objectForEachSeriesAsync, object, callback,
|
|
40
|
+
.then(thunkify3(_objectForEachSeriesAsync, object, callback, doneKeys))
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
return object
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const isPromise = require('./isPromise')
|
|
2
|
+
const curry3 = require('./curry3')
|
|
3
|
+
const thunkify4 = require('./thunkify4')
|
|
4
|
+
const objectSet = require('./objectSet')
|
|
5
|
+
const funcConcat = require('./funcConcat')
|
|
6
|
+
const symbolIterator = require('./symbolIterator')
|
|
7
|
+
|
|
8
|
+
// _objectMapSeriesAsync(
|
|
9
|
+
// object Object,
|
|
10
|
+
// f function,
|
|
11
|
+
// result Object,
|
|
12
|
+
// doneKeys Object
|
|
13
|
+
// ) -> Promise<object>
|
|
14
|
+
const _objectMapSeriesAsync = async function (object, f, result, doneKeys) {
|
|
15
|
+
for (const key in object) {
|
|
16
|
+
if (key in doneKeys) {
|
|
17
|
+
continue
|
|
18
|
+
}
|
|
19
|
+
let resultItem = f(object[key])
|
|
20
|
+
if (isPromise(resultItem)) {
|
|
21
|
+
resultItem = await resultItem
|
|
22
|
+
}
|
|
23
|
+
result[key] = resultItem
|
|
24
|
+
}
|
|
25
|
+
return result
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @name objectMapSeries
|
|
30
|
+
*
|
|
31
|
+
* @synopsis
|
|
32
|
+
* ```coffeescript [specscript]
|
|
33
|
+
* type ObjectMapper = (
|
|
34
|
+
* value any,
|
|
35
|
+
* key string,
|
|
36
|
+
* collection Object
|
|
37
|
+
* )=>(resultItem Promise|any)
|
|
38
|
+
*
|
|
39
|
+
* objectMapSeries(object Object, f ObjectMapper) -> Promise|Object
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @description
|
|
43
|
+
* Apply a function `f` in series to each value of an object, returning an object of results. `f` may be asynchronous.
|
|
44
|
+
*/
|
|
45
|
+
const objectMapSeries = function (object, f) {
|
|
46
|
+
const result = {}
|
|
47
|
+
const doneKeys = {}
|
|
48
|
+
for (const key in object) {
|
|
49
|
+
doneKeys[key] = true
|
|
50
|
+
const resultItem = f(object[key], key, object)
|
|
51
|
+
if (isPromise(resultItem)) {
|
|
52
|
+
return resultItem.then(funcConcat(
|
|
53
|
+
curry3(objectSet, result, key, __),
|
|
54
|
+
thunkify4(_objectMapSeriesAsync, object, f, result, doneKeys),
|
|
55
|
+
))
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return result
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
module.exports = objectMapSeries
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const isPromise = require('./isPromise')
|
|
2
|
+
const curry2 = require('./curry2')
|
|
3
|
+
const thunkify3 = require('./thunkify3')
|
|
4
|
+
const setAdd = require('./setAdd')
|
|
5
|
+
const funcConcat = require('./funcConcat')
|
|
6
|
+
const symbolIterator = require('./symbolIterator')
|
|
7
|
+
|
|
8
|
+
// _setMapSeriesAsync(
|
|
9
|
+
// iterator Iterator,
|
|
10
|
+
// f function,
|
|
11
|
+
// result Set,
|
|
12
|
+
// ) -> Promise<Set>
|
|
13
|
+
const _setMapSeriesAsync = async function (iterator, f, result) {
|
|
14
|
+
let iteration = iterator.next()
|
|
15
|
+
while (!iteration.done) {
|
|
16
|
+
let resultItem = f(iteration.value)
|
|
17
|
+
if (isPromise(resultItem)) {
|
|
18
|
+
resultItem = await resultItem
|
|
19
|
+
}
|
|
20
|
+
result.add(resultItem)
|
|
21
|
+
iteration = iterator.next()
|
|
22
|
+
}
|
|
23
|
+
return result
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @name setMapSeries
|
|
28
|
+
*
|
|
29
|
+
* @synopsis
|
|
30
|
+
* ```coffeescript [specscript]
|
|
31
|
+
* type SetMapper = (
|
|
32
|
+
* value any,
|
|
33
|
+
* key any,
|
|
34
|
+
* collection Set
|
|
35
|
+
* )=>(resultItem Promise|any)
|
|
36
|
+
*
|
|
37
|
+
* setMapSeries(set Set, f SetMapper) -> Promise|Set
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @description
|
|
41
|
+
* Apply a mapper in series to each value of a set, returning a new set of mapped items. Mapper may be asynchronous.
|
|
42
|
+
*/
|
|
43
|
+
const setMapSeries = function (set, f) {
|
|
44
|
+
const result = new Set()
|
|
45
|
+
const iterator = set[symbolIterator]()
|
|
46
|
+
let iteration = iterator.next()
|
|
47
|
+
while (!iteration.done) {
|
|
48
|
+
const resultItem = f(iteration.value)
|
|
49
|
+
if (isPromise(resultItem)) {
|
|
50
|
+
return resultItem.then(funcConcat(
|
|
51
|
+
curry2(setAdd, result, __),
|
|
52
|
+
thunkify3(_setMapSeriesAsync, iterator, f, result),
|
|
53
|
+
))
|
|
54
|
+
}
|
|
55
|
+
result.add(resultItem)
|
|
56
|
+
iteration = iterator.next()
|
|
57
|
+
}
|
|
58
|
+
return result
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
module.exports = setMapSeries
|
package/_internal/stringMap.js
CHANGED
|
@@ -17,7 +17,7 @@ const callPropUnary = require('./callPropUnary')
|
|
|
17
17
|
* ```
|
|
18
18
|
*
|
|
19
19
|
* @description
|
|
20
|
-
* Apply a mapper concurrently to each character of a string, returning a string result.
|
|
20
|
+
* Apply a mapper concurrently to each character of a string, returning a string result. mapper function may be asynchronous.
|
|
21
21
|
*
|
|
22
22
|
* @related stringFlatMap
|
|
23
23
|
*/
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const isPromise = require('./isPromise')
|
|
2
|
+
const curry3 = require('./curry3')
|
|
3
|
+
const __ = require('./placeholder')
|
|
4
|
+
const arrayMapSeries = require('./arrayMapSeries')
|
|
5
|
+
const callPropUnary = require('./callPropUnary')
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @name stringMapSeries
|
|
9
|
+
*
|
|
10
|
+
* @synopsis
|
|
11
|
+
* ```coffeescript [specscript]
|
|
12
|
+
* stringMapSeries<
|
|
13
|
+
* character string,
|
|
14
|
+
* str String<character>,
|
|
15
|
+
* mapper character=>Promise|string|any,
|
|
16
|
+
* >(str, mapper) -> stringWithCharactersMapped string
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @description
|
|
20
|
+
* Apply a mapper function in series to each character of a string, returning a string result. mapper function may be asynchronous.
|
|
21
|
+
*
|
|
22
|
+
* @related stringFlatMap
|
|
23
|
+
*/
|
|
24
|
+
const stringMapSeries = function (string, mapper) {
|
|
25
|
+
const result = arrayMapSeries(string, mapper)
|
|
26
|
+
return isPromise(result)
|
|
27
|
+
? result.then(curry3(callPropUnary, __, 'join', ''))
|
|
28
|
+
: result.join('')
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
module.exports = stringMapSeries
|
package/dist/Transducer.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.
|
|
2
|
+
* rubico v2.5.0
|
|
3
3
|
* https://github.com/a-synchronous/rubico
|
|
4
4
|
* (c) 2019-2024 Richard Tong
|
|
5
5
|
* rubico may be freely distributed under the MIT license.
|
|
6
6
|
*/
|
|
7
|
-
const isPromise=r=>null!=r&&"function"==typeof r.then,funcConcat=(r,e)=>function(...n){const t=r(...n);return isPromise(t)?t.then(e):e(t)},__=Symbol.for("placeholder"),curry2ResolveArg0=(r,e)=>function(n){return r(n,e)},curry2ResolveArg1=(r,e)=>function(n){return r(e,n)},curry2=function(r,e,n){return e==__?curry2ResolveArg0(r,n):curry2ResolveArg1(r,e)},reducerMap=(r,e)=>function(n,t){const c=e(t);return isPromise(c)?c.then(curry2(r,n,__)):r(n,c)},curry3ResolveArg0=(r,e,n)=>function(t){return r(t,e,n)},curry3ResolveArg1=(r,e,n)=>function(t){return r(e,t,n)},curry3ResolveArg2=(r,e,n)=>function(t){return r(e,n,t)},curry3=function(r,e,n,t){return e==__?curry3ResolveArg0(r,n,t):n==__?curry3ResolveArg1(r,e,t):curry3ResolveArg2(r,e,n)},thunkify2=(r,e,n)=>function(){return r(e,n)},thunkConditional=(r,e,n)=>r?e():n(),always=r=>function(){return r},reducerFilter=(r,e)=>function(n,t){const c=e(t);return isPromise(c)?c.then(curry3(thunkConditional,__,thunkify2(r,n,t),(
|
|
7
|
+
const isPromise=r=>null!=r&&"function"==typeof r.then,funcConcat=(r,e)=>function(...n){const t=r(...n);return isPromise(t)?t.then(e):e(t)},__=Symbol.for("placeholder"),curry2ResolveArg0=(r,e)=>function(n){return r(n,e)},curry2ResolveArg1=(r,e)=>function(n){return r(e,n)},curry2=function(r,e,n){return e==__?curry2ResolveArg0(r,n):curry2ResolveArg1(r,e)},reducerMap=(r,e)=>function(n,t){const c=e(t);return isPromise(c)?c.then(curry2(r,n,__)):r(n,c)},curry3ResolveArg0=(r,e,n)=>function(t){return r(t,e,n)},curry3ResolveArg1=(r,e,n)=>function(t){return r(e,t,n)},curry3ResolveArg2=(r,e,n)=>function(t){return r(e,n,t)},curry3=function(r,e,n,t){return e==__?curry3ResolveArg0(r,n,t):n==__?curry3ResolveArg1(r,e,t):curry3ResolveArg2(r,e,n)},thunkify2=(r,e,n)=>function(){return r(e,n)},thunkConditional=(r,e,n)=>r?e():n(),always=r=>function(){return r},reducerFilter=(r,e)=>function(n,t){const c=e(t);return isPromise(c)?c.then(curry3(thunkConditional,__,thunkify2(r,n,t),always(n))):c?r(n,t):n},isArray=Array.isArray,objectValues=Object.values,objectProto=Object.prototype,nativeObjectToString=objectProto.toString,objectToString=r=>nativeObjectToString.call(r),generatorFunctionTag="[object GeneratorFunction]",isGeneratorFunction=r=>objectToString(r)==generatorFunctionTag,asyncGeneratorFunctionTag="[object AsyncGeneratorFunction]",isAsyncGeneratorFunction=r=>objectToString(r)==asyncGeneratorFunctionTag,iteratorReduceAsync=async function(r,e,n){let t=r.next();if(t.done)return n;for(;!t.done;)n=e(n,t.value),isPromise(n)&&(n=await n),t=r.next();return n},iteratorReduce=function(r,e,n){let t=r.next();if(t.done)return n;for(void 0===n&&(n=t.value,t=r.next());!t.done;){if(n=e(n,t.value),isPromise(n))return n.then(curry3(iteratorReduceAsync,r,e,__));t=r.next()}return n},asyncIteratorReduce=async function(r,e,n){let t=await r.next();if(t.done)return n;for(void 0===n&&(n=t.value,t=await r.next());!t.done;)n=await e(n,t.value),t=await r.next();return n},symbolIterator=Symbol.iterator,symbolAsyncIterator=Symbol.asyncIterator,curryArgs3ResolveArgs0=(r,e,n)=>function(...t){return r(t,e,n)},curryArgs3ResolveArgs1=(r,e,n)=>function(...t){return r(e,t,n)},curryArgs3ResolveArgs2=(r,e,n)=>function(...t){return r(e,n,t)},curryArgs3=function(r,e,n,t){return e==__?curryArgs3ResolveArgs0(r,n,t):n==__?curryArgs3ResolveArgs1(r,e,t):curryArgs3ResolveArgs2(r,e,n)},curry4ResolveArg0=(r,e,n,t)=>function(c){return r(c,e,n,t)},curry4ResolveArg1=(r,e,n,t)=>function(c){return r(e,c,n,t)},curry4ResolveArg2=(r,e,n,t)=>function(c){return r(e,n,c,t)},curry4ResolveArg3=(r,e,n,t)=>function(c){return r(e,n,t,c)},curry4=function(r,e,n,t,c){return e==__?curry4ResolveArg0(r,n,t,c):n==__?curry4ResolveArg1(r,e,t,c):t==__?curry4ResolveArg2(r,e,n,c):curry4ResolveArg3(r,e,n,t)},arrayReduceAsync=async function(r,e,n,t){const c=r.length;for(;++t<c;)n=e(n,r[t],t,r),isPromise(n)&&(n=await n);return n},arrayReduce=function(r,e,n){const t=r.length;let c=-1;for(void 0===n&&(n=r[++c]);++c<t;)if(n=e(n,r[c],c,r),isPromise(n))return n.then(curry4(arrayReduceAsync,r,e,__,c));return n},curry5ResolveArg0=(r,e,n,t,c)=>function(o){return r(o,e,n,t,c)},curry5ResolveArg1=(r,e,n,t,c)=>function(o){return r(e,o,n,t,c)},curry5ResolveArg2=(r,e,n,t,c)=>function(o){return r(e,n,o,t,c)},curry5ResolveArg3=(r,e,n,t,c)=>function(o){return r(e,n,t,o,c)},curry5ResolveArg4=(r,e,n,t,c)=>function(o){return r(e,n,t,c,o)},curry5=function(r,e,n,t,c,o){return e==__?curry5ResolveArg0(r,n,t,c,o):n==__?curry5ResolveArg1(r,e,t,c,o):t==__?curry5ResolveArg2(r,e,n,c,o):c==__?curry5ResolveArg3(r,e,n,t,o):curry5ResolveArg4(r,e,n,t,c)},objectKeys=Object.keys,objectReduceAsync=async function(r,e,n,t,c){const o=t.length;for(;++c<o;){const o=t[c];n=e(n,r[o],o,r),isPromise(n)&&(n=await n)}return n},objectReduce=function(r,e,n){const t=objectKeys(r),c=t.length;let o=-1;for(void 0===n&&(n=r[t[++o]]);++o<c;){const c=t[o];if(n=e(n,r[c],c,r),isPromise(n))return n.then(curry5(objectReduceAsync,r,e,__,t,o))}return n},mapReduceAsync=async function(r,e,n,t){for(const[c,o]of t)n=e(n,o,c,r),isPromise(n)&&(n=await n);return n},mapReduce=function(r,e,n){const t=r.entries();if(void 0===n){const r=t.next();if(r.done)return n;n=r.value[1]}for(const[c,o]of t)if(n=e(n,o,c,r),isPromise(n))return n.then(curry4(mapReduceAsync,r,e,__,t));return n},reducerConcat=(r,e)=>function(n,t){const c=r(n,t);return isPromise(c)?c.then(curry2(e,__,t)):e(c,t)},genericReduce=function(r,e,n){return isArray(r)?arrayReduce(r,e,n):null==r?void 0===n?curry2(e,r,__):e(n,r):r.constructor==Map?mapReduce(r,e,n):"function"==typeof r[symbolIterator]?iteratorReduce(r[symbolIterator](),e,n):"function"==typeof r[symbolAsyncIterator]?asyncIteratorReduce(r[symbolAsyncIterator](),e,n):"function"==typeof r.reduce?r.reduce(e,n):"function"==typeof r.chain?r.chain(curry2(e,n,__)):"function"==typeof r.flatMap?r.flatMap(curry2(e,n,__)):r.constructor==Object?objectReduce(r,e,n):void 0===n?curry2(e,r,__):e(n,r)},reducerFlatMap=(r,e)=>function(n,t){const c=e(t);return isPromise(c)?c.then(curry3(genericReduce,__,r,n)):genericReduce(c,r,n)},reducerForEach=(r,e)=>function(n,t){const c=e(t);return isPromise(c)?c.then(thunkify2(r,n,t)):r(n,t)},_reducerTryCatchErrorHandler=function(r,e,n,t,c){const o=r(n,c);return isPromise(o)?o.then(curry2(e,t,__)):e(t,o)},reducerTryCatch=function(r,e,n){const t=e(r);return function(e,c){try{const o=t(e,c);return isPromise(o)?o.catch(curry5(_reducerTryCatchErrorHandler,n,r,__,e,c)):o}catch(t){return _reducerTryCatchErrorHandler(n,r,t,e,c)}}},Transducer={map:function(r){return curry2(reducerMap,__,r)},filter:function(r){return curry2(reducerFilter,__,r)},flatMap:function(r){return curry2(reducerFlatMap,__,r)},forEach:function(r){return curry2(reducerForEach,__,r)},passthrough:function(r){return r},tryCatch:function(r,e){return curry3(reducerTryCatch,__,r,e)}};export default Transducer;
|
package/dist/Transducer.js
CHANGED
package/dist/Transducer.min.js
CHANGED
package/dist/Transducer.mjs
CHANGED
package/dist/__.es.js
CHANGED
package/dist/__.es.min.js
CHANGED
package/dist/__.js
CHANGED
package/dist/__.min.js
CHANGED
package/dist/__.mjs
CHANGED
package/dist/all.es.js
CHANGED
package/dist/all.es.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.
|
|
2
|
+
* rubico v2.5.0
|
|
3
3
|
* https://github.com/a-synchronous/rubico
|
|
4
4
|
* (c) 2019-2024 Richard Tong
|
|
5
5
|
* rubico may be freely distributed under the MIT license.
|
|
6
6
|
*/
|
|
7
|
-
const isPromise=r=>null!=r&&"function"==typeof r.then,areAnyValuesPromises=function(r){const n=r.length;let e=-1;for(;++e<n;){const n=r[e];if(isPromise(n))return!0}return!1},promiseAll=Promise.all.bind(Promise),isArray=Array.isArray,__=Symbol.for("placeholder"),curry2ResolveArg0=(r,n)=>function(e){return r(e,n)},curry2ResolveArg1=(r,n)=>function(e){return r(n,e)},curry2=function(r,n,e){return n==__?curry2ResolveArg0(r,e):curry2ResolveArg1(r,n)},curryArgs2ResolveArgs0=(r,n,e)=>function(...e){return r(e,n)},curryArgs2ResolveArgs1=(r,n,e)=>function(...e){return r(n,e)},curryArgs2=function(r,n,e){return n==__?curryArgs2ResolveArgs0(r,e):curryArgs2ResolveArgs1(r,n)},functionArrayAll=function(r,n){const e=r.length,t=Array(e);let o=-1,u=!1;for(;++o<e;){const e=r[o](...n);isPromise(e)&&(u=!0),t[o]=e}return u?promiseAll(t):t},funcConcat=(r,n)=>function(...e){const t=r(...e);return isPromise(t)?t.then(n):n(t)},curry3ResolveArg0=(r,n,e)=>function(t){return r(t,n,e)},curry3ResolveArg1=(r,n,e)=>function(t){return r(n,t,e)},curry3ResolveArg2=(r,n,e)=>function(t){return r(n,e,t)},curry3=function(r,n,e,t){return n==__?curry3ResolveArg0(r,e,t):e==__?curry3ResolveArg1(r,n,t):curry3ResolveArg2(r,n,e)},curry4ResolveArg0=(r,n,e,t)=>function(o){return r(o,n,e,t)},curry4ResolveArg1=(r,n,e,t)=>function(o){return r(n,o,e,t)},curry4ResolveArg2=(r,n,e,t)=>function(o){return r(n,e,o,t)},curry4ResolveArg3=(r,n,e,t)=>function(o){return r(n,e,t,o)},curry4=function(r,n,e,t,o){return n==__?curry4ResolveArg0(r,e,t,o):e==__?curry4ResolveArg1(r,n,t,o):t==__?curry4ResolveArg2(r,n,e,o):curry4ResolveArg3(r,n,e,t)},objectSet=function(r,n,e){return r[n]=e,r},asyncFunctionArrayAllSeries=async function(r,n,e,t){const o=r.length;for(;++t<o;){const o=r[t](...n);e[t]=isPromise(o)?await o:o}return e},functionArrayAllSeries=function(r,n){const e=r.length,t=[];let o=-1;for(;++o<e;){const e=r[o](...n);if(isPromise(e))return e.then(funcConcat(curry3(objectSet,t,o,__),(
|
|
7
|
+
const isPromise=r=>null!=r&&"function"==typeof r.then,areAnyValuesPromises=function(r){const n=r.length;let e=-1;for(;++e<n;){const n=r[e];if(isPromise(n))return!0}return!1},promiseAll=Promise.all.bind(Promise),isArray=Array.isArray,__=Symbol.for("placeholder"),curry2ResolveArg0=(r,n)=>function(e){return r(e,n)},curry2ResolveArg1=(r,n)=>function(e){return r(n,e)},curry2=function(r,n,e){return n==__?curry2ResolveArg0(r,e):curry2ResolveArg1(r,n)},curryArgs2ResolveArgs0=(r,n,e)=>function(...e){return r(e,n)},curryArgs2ResolveArgs1=(r,n,e)=>function(...e){return r(n,e)},curryArgs2=function(r,n,e){return n==__?curryArgs2ResolveArgs0(r,e):curryArgs2ResolveArgs1(r,n)},functionArrayAll=function(r,n){const e=r.length,t=Array(e);let o=-1,u=!1;for(;++o<e;){const e=r[o](...n);isPromise(e)&&(u=!0),t[o]=e}return u?promiseAll(t):t},funcConcat=(r,n)=>function(...e){const t=r(...e);return isPromise(t)?t.then(n):n(t)},curry3ResolveArg0=(r,n,e)=>function(t){return r(t,n,e)},curry3ResolveArg1=(r,n,e)=>function(t){return r(n,t,e)},curry3ResolveArg2=(r,n,e)=>function(t){return r(n,e,t)},curry3=function(r,n,e,t){return n==__?curry3ResolveArg0(r,e,t):e==__?curry3ResolveArg1(r,n,t):curry3ResolveArg2(r,n,e)},curry4ResolveArg0=(r,n,e,t)=>function(o){return r(o,n,e,t)},curry4ResolveArg1=(r,n,e,t)=>function(o){return r(n,o,e,t)},curry4ResolveArg2=(r,n,e,t)=>function(o){return r(n,e,o,t)},curry4ResolveArg3=(r,n,e,t)=>function(o){return r(n,e,t,o)},curry4=function(r,n,e,t,o){return n==__?curry4ResolveArg0(r,e,t,o):e==__?curry4ResolveArg1(r,n,t,o):t==__?curry4ResolveArg2(r,n,e,o):curry4ResolveArg3(r,n,e,t)},objectSet=function(r,n,e){return r[n]=e,r},asyncFunctionArrayAllSeries=async function(r,n,e,t){const o=r.length;for(;++t<o;){const o=r[t](...n);e[t]=isPromise(o)?await o:o}return e},functionArrayAllSeries=function(r,n){const e=r.length,t=[];let o=-1;for(;++o<e;){const e=r[o](...n);if(isPromise(e))return e.then(funcConcat(curry3(objectSet,t,o,__),curry4(asyncFunctionArrayAllSeries,r,n,__,o)));t[o]=e}return t},always=r=>function(){return r},functionObjectAll=function(r,n){const e={},t=[];for(const o in r){const u=r[o](...n);isPromise(u)?t.push(u.then(curry3(objectSet,e,o,__))):e[o]=u}return 0==t.length?e:promiseAll(t).then(always(e))},all=function(...r){const n=r.pop();return 0==r.length?isArray(n)?curryArgs2(functionArrayAll,n,__):curryArgs2(functionObjectAll,n,__):areAnyValuesPromises(r)?isArray(n)?promiseAll(r).then(curry2(functionArrayAll,n,__)):promiseAll(r).then(curry2(functionObjectAll,n,__)):isArray(n)?functionArrayAll(n,r):functionObjectAll(n,r)};all.series=function(...r){const n=r.pop();return 0==r.length?curryArgs2(functionArrayAllSeries,n,__):areAnyValuesPromises(r)?promiseAll(r).then(curry2(functionArrayAllSeries,n,__)):functionArrayAllSeries(n,r)};export default all;
|
package/dist/all.js
CHANGED
package/dist/all.min.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.
|
|
2
|
+
* rubico v2.5.0
|
|
3
3
|
* https://github.com/a-synchronous/rubico
|
|
4
4
|
* (c) 2019-2024 Richard Tong
|
|
5
5
|
* rubico may be freely distributed under the MIT license.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
!function(n,t){"object"==typeof module?module.exports=t:"function"==typeof define?define((()=>t)):n.all=t}("object"==typeof globalThis?globalThis:this,function(){"use strict";const n=n=>null!=n&&"function"==typeof n.then,t=function(t){const r=t.length;let o=-1;for(;++o<r;){const r=t[o];if(n(r))return!0}return!1},r=Promise.all.bind(Promise),o=Array.isArray,e=Symbol.for("placeholder"),u=function(n,t,r){return t==e?((n,t)=>function(r){return n(r,t)})(n,r):((n,t)=>function(r){return n(t,r)})(n,t)},c=function(n,t,r){return t==e?((n,t
|
|
8
|
+
!function(n,t){"object"==typeof module?module.exports=t:"function"==typeof define?define((()=>t)):n.all=t}("object"==typeof globalThis?globalThis:this,function(){"use strict";const n=n=>null!=n&&"function"==typeof n.then,t=function(t){const r=t.length;let o=-1;for(;++o<r;){const r=t[o];if(n(r))return!0}return!1},r=Promise.all.bind(Promise),o=Array.isArray,e=Symbol.for("placeholder"),u=function(n,t,r){return t==e?((n,t)=>function(r){return n(r,t)})(n,r):((n,t)=>function(r){return n(t,r)})(n,t)},c=function(n,t,r){return t==e?((n,t)=>function(...r){return n(r,t)})(n,r):((n,t)=>function(...r){return n(t,r)})(n,t)},i=function(t,o){const e=t.length,u=Array(e);let c=-1,i=!1;for(;++c<e;){const r=t[c](...o);n(r)&&(i=!0),u[c]=r}return i?r(u):u},f=(t,r)=>function(...o){const e=t(...o);return n(e)?e.then(r):r(e)},s=function(n,t,r,o){return t==e?((n,t,r)=>function(o){return n(o,t,r)})(n,r,o):r==e?((n,t,r)=>function(o){return n(t,o,r)})(n,t,o):((n,t,r)=>function(o){return n(t,r,o)})(n,t,r)},l=function(n,t,r){return n[t]=r,n},h=async function(t,r,o,e){const u=t.length;for(;++e<u;){const u=t[e](...r);o[e]=n(u)?await u:u}return o},a=function(t,r){const o=t.length,u=[];let c=-1;for(;++c<o;){const o=t[c](...r);if(n(o))return o.then(f(s(l,u,c,e),(i=h,p=r,g=e,y=c,(a=t)==e?((n,t,r,o)=>function(e){return n(e,t,r,o)})(i,p,g,y):p==e?((n,t,r,o)=>function(e){return n(t,e,r,o)})(i,a,g,y):g==e?((n,t,r,o)=>function(e){return n(t,r,e,o)})(i,a,p,y):((n,t,r,o)=>function(e){return n(t,r,o,e)})(i,a,p,g))));u[c]=o}var i,a,p,g,y;return u},p=function(t,o){const u={},c=[];for(const r in t){const i=t[r](...o);n(i)?c.push(i.then(s(l,u,r,e))):u[r]=i}return 0==c.length?u:r(c).then((i=u,function(){return i}));var i},g=function(...n){const f=n.pop();return 0==n.length?o(f)?c(i,f,e):c(p,f,e):t(n)?o(f)?r(n).then(u(i,f,e)):r(n).then(u(p,f,e)):o(f)?i(f,n):p(f,n)};return g.series=function(...n){const o=n.pop();return 0==n.length?c(a,o,e):t(n)?r(n).then(u(a,o,e)):a(o,n)},g}());
|
package/dist/all.mjs
CHANGED
package/dist/always.es.js
CHANGED
package/dist/always.es.min.js
CHANGED
package/dist/always.js
CHANGED
package/dist/always.min.js
CHANGED
package/dist/always.mjs
CHANGED
package/dist/and.es.js
CHANGED
package/dist/and.es.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.
|
|
2
|
+
* rubico v2.5.0
|
|
3
3
|
* https://github.com/a-synchronous/rubico
|
|
4
4
|
* (c) 2019-2024 Richard Tong
|
|
5
5
|
* rubico may be freely distributed under the MIT license.
|
|
6
6
|
*/
|
|
7
|
-
const promiseAll=Promise.all.bind(Promise),isPromise=r=>null!=r&&"function"==typeof r.then,areAnyValuesPromises=function(r){const e=r.length;let n=-1;for(;++n<e;){const e=r[n];if(isPromise(e))return!0}return!1},__=Symbol.for("placeholder"),curry2ResolveArg0=(r,e)=>function(n){return r(n,e)},curry2ResolveArg1=(r,e)=>function(n){return r(e,n)},curry2=function(r,e,n){return e==__?curry2ResolveArg0(r,n):curry2ResolveArg1(r,e)},curry3ResolveArg0=(r,e,n)=>function(t){return r(t,e,n)},curry3ResolveArg1=(r,e,n)=>function(t){return r(e,t,n)},curry3ResolveArg2=(r,e,n)=>function(t){return r(e,n,t)},curry3=function(r,e,n,t){return e==__?curry3ResolveArg0(r,n,t):n==__?curry3ResolveArg1(r,e,t):curry3ResolveArg2(r,e,n)},curryArgs2ResolveArgs0=(r,e,n)=>function(...n){return r(n,e)},curryArgs2ResolveArgs1=(r,e,n)=>function(...n){return r(e,n)},curryArgs2=function(r,e,n){return e==__?curryArgs2ResolveArgs0(r,n):curryArgs2ResolveArgs1(r,e)},thunkConditional=(r,e,n)=>r?e():n(),areAllValuesNonfunctions=function(r){const e=r.length;let n=-1;for(;++n<e;)if("function"==typeof r[n])return!1;return!0},thunkify2=(r,e,n)=>function(){return r(e,n)},thunkify3=(r,e,n,t)=>function(){return r(e,n,t)},always=r=>function(){return r},areAllValuesTruthy=function(r,e){const n=r.length;for(;++e<n;){const n=r[e];if(isPromise(n))return n.then(curry3(thunkConditional,__,thunkify2(areAllValuesTruthy,r,e),always(!1)));if(!n)return!1}return!0},asyncArePredicatesAllTruthy=async function(r,e,n){const t=e.length;for(;++n<t;){let t=e[n];if("function"==typeof t&&(t=t(...r)),isPromise(t)&&(t=await t),!t)return!1}return!0},areAllPredicatesTruthy=function(r,e){const n=e.length;let t=-1;for(;++t<n;){let n=e[t];if("function"==typeof n&&(n=n(...r)),isPromise(n))return n.then(curry3(thunkConditional,__,thunkify3(asyncArePredicatesAllTruthy,r,e,t),always(!1)));if(!n)return!1}return!0},and=function(...r){const e=r.pop();return areAllValuesNonfunctions(e)?areAllValuesTruthy(e,-1):0==r.length?(
|
|
7
|
+
const promiseAll=Promise.all.bind(Promise),isPromise=r=>null!=r&&"function"==typeof r.then,areAnyValuesPromises=function(r){const e=r.length;let n=-1;for(;++n<e;){const e=r[n];if(isPromise(e))return!0}return!1},__=Symbol.for("placeholder"),curry2ResolveArg0=(r,e)=>function(n){return r(n,e)},curry2ResolveArg1=(r,e)=>function(n){return r(e,n)},curry2=function(r,e,n){return e==__?curry2ResolveArg0(r,n):curry2ResolveArg1(r,e)},curry3ResolveArg0=(r,e,n)=>function(t){return r(t,e,n)},curry3ResolveArg1=(r,e,n)=>function(t){return r(e,t,n)},curry3ResolveArg2=(r,e,n)=>function(t){return r(e,n,t)},curry3=function(r,e,n,t){return e==__?curry3ResolveArg0(r,n,t):n==__?curry3ResolveArg1(r,e,t):curry3ResolveArg2(r,e,n)},curryArgs2ResolveArgs0=(r,e,n)=>function(...n){return r(n,e)},curryArgs2ResolveArgs1=(r,e,n)=>function(...n){return r(e,n)},curryArgs2=function(r,e,n){return e==__?curryArgs2ResolveArgs0(r,n):curryArgs2ResolveArgs1(r,e)},thunkConditional=(r,e,n)=>r?e():n(),areAllValuesNonfunctions=function(r){const e=r.length;let n=-1;for(;++n<e;)if("function"==typeof r[n])return!1;return!0},thunkify2=(r,e,n)=>function(){return r(e,n)},thunkify3=(r,e,n,t)=>function(){return r(e,n,t)},always=r=>function(){return r},areAllValuesTruthy=function(r,e){const n=r.length;for(;++e<n;){const n=r[e];if(isPromise(n))return n.then(curry3(thunkConditional,__,thunkify2(areAllValuesTruthy,r,e),always(!1)));if(!n)return!1}return!0},asyncArePredicatesAllTruthy=async function(r,e,n){const t=e.length;for(;++n<t;){let t=e[n];if("function"==typeof t&&(t=t(...r)),isPromise(t)&&(t=await t),!t)return!1}return!0},areAllPredicatesTruthy=function(r,e){const n=e.length;let t=-1;for(;++t<n;){let n=e[t];if("function"==typeof n&&(n=n(...r)),isPromise(n))return n.then(curry3(thunkConditional,__,thunkify3(asyncArePredicatesAllTruthy,r,e,t),always(!1)));if(!n)return!1}return!0},and=function(...r){const e=r.pop();return areAllValuesNonfunctions(e)?areAllValuesTruthy(e,-1):0==r.length?curryArgs2(areAllPredicatesTruthy,__,e):areAnyValuesPromises(r)?promiseAll(r).then(curry2(areAllPredicatesTruthy,__,e)):areAllPredicatesTruthy(r,e)};export default and;
|
package/dist/and.js
CHANGED
package/dist/and.min.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.
|
|
2
|
+
* rubico v2.5.0
|
|
3
3
|
* https://github.com/a-synchronous/rubico
|
|
4
4
|
* (c) 2019-2024 Richard Tong
|
|
5
5
|
* rubico may be freely distributed under the MIT license.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
!function(n,t){"object"==typeof module?module.exports=t:"function"==typeof define?define((()=>t)):n.and=t}("object"==typeof globalThis?globalThis:this,function(){"use strict";const n=Promise.all.bind(Promise),t=n=>null!=n&&"function"==typeof n.then,r=Symbol.for("placeholder"),e=function(n,t,e,o){return t==r?((n,t,r)=>function(e){return n(e,t,r)})(n,e,o):e==r?((n,t,r)=>function(e){return n(t,e,r)})(n,t,o):((n,t,r)=>function(e){return n(t,r,e)})(n,t,e)},o=(n,t,r)=>n?t():r(),u=(n,t,r)=>function(){return n(t,r)},f=(n,t,r,e)=>function(){return n(t,r,e)},i=n=>function(){return n},c=function(n,f){const l=n.length;for(;++f<l;){const l=n[f];if(t(l))return l.then(e(o,r,u(c,n,f),i(!1)));if(!l)return!1}return!0},l=async function(n,r,e){const o=r.length;for(;++e<o;){let o=r[e];if("function"==typeof o&&(o=o(...n)),t(o)&&(o=await o),!o)return!1}return!0},s=function(n,u){const c=u.length;let s=-1;for(;++s<c;){let c=u[s];if("function"==typeof c&&(c=c(...n)),t(c))return c.then(e(o,r,f(l,n,u,s),i(!1)));if(!c)return!1}return!0};return function(...e){const o=e.pop();return function(n){const t=n.length;let r=-1;for(;++r<t;)if("function"==typeof n[r])return!1;return!0}(o)?c(o,-1):0==e.length?(u=s,i=o,(f=r)==r?((n,t
|
|
8
|
+
!function(n,t){"object"==typeof module?module.exports=t:"function"==typeof define?define((()=>t)):n.and=t}("object"==typeof globalThis?globalThis:this,function(){"use strict";const n=Promise.all.bind(Promise),t=n=>null!=n&&"function"==typeof n.then,r=Symbol.for("placeholder"),e=function(n,t,e,o){return t==r?((n,t,r)=>function(e){return n(e,t,r)})(n,e,o):e==r?((n,t,r)=>function(e){return n(t,e,r)})(n,t,o):((n,t,r)=>function(e){return n(t,r,e)})(n,t,e)},o=(n,t,r)=>n?t():r(),u=(n,t,r)=>function(){return n(t,r)},f=(n,t,r,e)=>function(){return n(t,r,e)},i=n=>function(){return n},c=function(n,f){const l=n.length;for(;++f<l;){const l=n[f];if(t(l))return l.then(e(o,r,u(c,n,f),i(!1)));if(!l)return!1}return!0},l=async function(n,r,e){const o=r.length;for(;++e<o;){let o=r[e];if("function"==typeof o&&(o=o(...n)),t(o)&&(o=await o),!o)return!1}return!0},s=function(n,u){const c=u.length;let s=-1;for(;++s<c;){let c=u[s];if("function"==typeof c&&(c=c(...n)),t(c))return c.then(e(o,r,f(l,n,u,s),i(!1)));if(!c)return!1}return!0};return function(...e){const o=e.pop();return function(n){const t=n.length;let r=-1;for(;++r<t;)if("function"==typeof n[r])return!1;return!0}(o)?c(o,-1):0==e.length?(u=s,i=o,(f=r)==r?((n,t)=>function(...r){return n(r,t)})(u,i):((n,t)=>function(...r){return n(t,r)})(u,f)):function(n){const r=n.length;let e=-1;for(;++e<r;){const r=n[e];if(t(r))return!0}return!1}(e)?n(e).then(function(n,t,e){return t==r?((n,t)=>function(r){return n(r,t)})(n,e):((n,t)=>function(r){return n(t,r)})(n,t)}(s,r,o)):s(e,o);var u,f,i}}());
|
package/dist/and.mjs
CHANGED
package/dist/assign.es.js
CHANGED
package/dist/assign.es.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.
|
|
2
|
+
* rubico v2.5.0
|
|
3
3
|
* https://github.com/a-synchronous/rubico
|
|
4
4
|
* (c) 2019-2024 Richard Tong
|
|
5
5
|
* rubico may be freely distributed under the MIT license.
|
|
6
6
|
*/
|
|
7
|
-
const isPromise=r=>null!=r&&"function"==typeof r.then,objectAssign=Object.assign,__=Symbol.for("placeholder"),curry2ResolveArg0=(r,n)=>function(e){return r(e,n)},curry2ResolveArg1=(r,n)=>function(e){return r(n,e)},curry2=function(r,n,e){return n==__?curry2ResolveArg0(r,e):curry2ResolveArg1(r,n)},curry3ResolveArg0=(r,n,e)=>function(t){return r(t,n,e)},curry3ResolveArg1=(r,n,e)=>function(t){return r(n,t,e)},curry3ResolveArg2=(r,n,e)=>function(t){return r(n,e,t)},curry3=function(r,n,e,t){return n==__?curry3ResolveArg0(r,e,t):e==__?curry3ResolveArg1(r,n,t):curry3ResolveArg2(r,n,e)},always=r=>function(){return r},promiseAll=Promise.all.bind(Promise),objectSet=function(r,n,e){return r[n]=e,r},functionObjectAll=function(r,n){const e={},t=[];for(const o in r){const
|
|
7
|
+
const isPromise=r=>null!=r&&"function"==typeof r.then,objectAssign=Object.assign,__=Symbol.for("placeholder"),curry2ResolveArg0=(r,n)=>function(e){return r(e,n)},curry2ResolveArg1=(r,n)=>function(e){return r(n,e)},curry2=function(r,n,e){return n==__?curry2ResolveArg0(r,e):curry2ResolveArg1(r,n)},curry3ResolveArg0=(r,n,e)=>function(t){return r(t,n,e)},curry3ResolveArg1=(r,n,e)=>function(t){return r(n,t,e)},curry3ResolveArg2=(r,n,e)=>function(t){return r(n,e,t)},curry3=function(r,n,e,t){return n==__?curry3ResolveArg0(r,e,t):e==__?curry3ResolveArg1(r,n,t):curry3ResolveArg2(r,n,e)},always=r=>function(){return r},promiseAll=Promise.all.bind(Promise),objectSet=function(r,n,e){return r[n]=e,r},functionObjectAll=function(r,n){const e={},t=[];for(const o in r){const s=r[o](...n);isPromise(s)?t.push(s.then(curry3(objectSet,e,o,__))):e[o]=s}return 0==t.length?e:promiseAll(t).then(always(e))},_assign=function(r,n){const e=functionObjectAll(n,[r]);return isPromise(e)?e.then(curry3(objectAssign,{},r,__)):{...r,...e}},assign=function(r,n){return null==n?curry2(_assign,__,r):isPromise(r)?r.then(curry2(_assign,__,n)):_assign(r,n)};export default assign;
|
package/dist/assign.js
CHANGED
package/dist/assign.min.js
CHANGED
package/dist/assign.mjs
CHANGED
package/dist/compose.es.js
CHANGED