rubico 2.8.0 → 2.8.2
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/LICENSE +5 -17
- package/README.md +1 -1
- package/_internal/curryArity.js +21 -1
- package/_internal/funcApply2.js +18 -0
- package/curry.js +38 -11
- package/dist/Transducer.es.js +5 -4
- package/dist/Transducer.es.min.js +5 -4
- package/dist/Transducer.js +5 -4
- package/dist/Transducer.min.js +5 -4
- package/dist/Transducer.mjs +5 -4
- package/dist/__.es.js +5 -4
- package/dist/__.es.min.js +5 -4
- package/dist/__.js +5 -4
- package/dist/__.min.js +5 -4
- package/dist/__.mjs +5 -4
- package/dist/all.es.js +5 -4
- package/dist/all.es.min.js +5 -4
- package/dist/all.js +5 -4
- package/dist/all.min.js +5 -4
- package/dist/all.mjs +5 -4
- package/dist/always.es.js +5 -4
- package/dist/always.es.min.js +5 -4
- package/dist/always.js +5 -4
- package/dist/always.min.js +5 -4
- package/dist/always.mjs +5 -4
- package/dist/and.es.js +5 -4
- package/dist/and.es.min.js +5 -4
- package/dist/and.js +5 -4
- package/dist/and.min.js +5 -4
- package/dist/and.mjs +5 -4
- package/dist/assign.es.js +5 -4
- package/dist/assign.es.min.js +5 -4
- package/dist/assign.js +5 -4
- package/dist/assign.min.js +5 -4
- package/dist/assign.mjs +5 -4
- package/dist/compose.es.js +5 -4
- package/dist/compose.es.min.js +5 -4
- package/dist/compose.js +5 -4
- package/dist/compose.min.js +5 -4
- package/dist/compose.mjs +5 -4
- package/dist/curry.es.js +136 -6
- package/dist/curry.es.min.js +6 -5
- package/dist/curry.js +136 -6
- package/dist/curry.min.js +6 -5
- package/dist/curry.mjs +136 -6
- package/dist/eq.es.js +5 -4
- package/dist/eq.es.min.js +5 -4
- package/dist/eq.js +5 -4
- package/dist/eq.min.js +5 -4
- package/dist/eq.mjs +5 -4
- package/dist/every.es.js +5 -4
- package/dist/every.es.min.js +5 -4
- package/dist/every.js +5 -4
- package/dist/every.min.js +5 -4
- package/dist/every.mjs +5 -4
- package/dist/filter.es.js +5 -4
- package/dist/filter.es.min.js +5 -4
- package/dist/filter.js +5 -4
- package/dist/filter.min.js +5 -4
- package/dist/filter.mjs +5 -4
- package/dist/flatMap.es.js +5 -4
- package/dist/flatMap.es.min.js +5 -4
- package/dist/flatMap.js +5 -4
- package/dist/flatMap.min.js +5 -4
- package/dist/flatMap.mjs +5 -4
- package/dist/forEach.es.js +5 -4
- package/dist/forEach.es.min.js +5 -4
- package/dist/forEach.js +5 -4
- package/dist/forEach.min.js +5 -4
- package/dist/forEach.mjs +5 -4
- package/dist/get.es.js +5 -4
- package/dist/get.es.min.js +5 -4
- package/dist/get.js +5 -4
- package/dist/get.min.js +5 -4
- package/dist/get.mjs +5 -4
- package/dist/gt.es.js +5 -4
- package/dist/gt.es.min.js +5 -4
- package/dist/gt.js +5 -4
- package/dist/gt.min.js +5 -4
- package/dist/gt.mjs +5 -4
- package/dist/gte.es.js +5 -4
- package/dist/gte.es.min.js +5 -4
- package/dist/gte.js +5 -4
- package/dist/gte.min.js +5 -4
- package/dist/gte.mjs +5 -4
- package/dist/lt.es.js +5 -4
- package/dist/lt.es.min.js +5 -4
- package/dist/lt.js +5 -4
- package/dist/lt.min.js +5 -4
- package/dist/lt.mjs +5 -4
- package/dist/lte.es.js +5 -4
- package/dist/lte.es.min.js +5 -4
- package/dist/lte.js +5 -4
- package/dist/lte.min.js +5 -4
- package/dist/lte.mjs +5 -4
- package/dist/map.es.js +45 -5
- package/dist/map.es.min.js +6 -5
- package/dist/map.js +45 -5
- package/dist/map.min.js +6 -5
- package/dist/map.mjs +45 -5
- package/dist/not.es.js +5 -4
- package/dist/not.es.min.js +5 -4
- package/dist/not.js +5 -4
- package/dist/not.min.js +5 -4
- package/dist/not.mjs +5 -4
- package/dist/omit.es.js +5 -4
- package/dist/omit.es.min.js +5 -4
- package/dist/omit.js +5 -4
- package/dist/omit.min.js +5 -4
- package/dist/omit.mjs +5 -4
- package/dist/or.es.js +5 -4
- package/dist/or.es.min.js +5 -4
- package/dist/or.js +5 -4
- package/dist/or.min.js +5 -4
- package/dist/or.mjs +5 -4
- package/dist/pick.es.js +5 -4
- package/dist/pick.es.min.js +5 -4
- package/dist/pick.js +5 -4
- package/dist/pick.min.js +5 -4
- package/dist/pick.mjs +5 -4
- package/dist/pipe.es.js +5 -4
- package/dist/pipe.es.min.js +5 -4
- package/dist/pipe.js +5 -4
- package/dist/pipe.min.js +5 -4
- package/dist/pipe.mjs +5 -4
- package/dist/reduce.es.js +5 -4
- package/dist/reduce.es.min.js +5 -4
- package/dist/reduce.js +5 -4
- package/dist/reduce.min.js +5 -4
- package/dist/reduce.mjs +5 -4
- package/dist/rubico.es.js +51 -9
- package/dist/rubico.es.min.js +6 -5
- package/dist/rubico.global.js +51 -9
- package/dist/rubico.global.min.js +6 -5
- package/dist/rubico.js +51 -9
- package/dist/rubico.min.js +6 -5
- package/dist/rubico.mjs +51 -9
- package/dist/set.es.js +5 -4
- package/dist/set.es.min.js +5 -4
- package/dist/set.js +5 -4
- package/dist/set.min.js +5 -4
- package/dist/set.mjs +5 -4
- package/dist/some.es.js +5 -4
- package/dist/some.es.min.js +5 -4
- package/dist/some.js +5 -4
- package/dist/some.min.js +5 -4
- package/dist/some.mjs +5 -4
- package/dist/switchCase.es.js +5 -4
- package/dist/switchCase.es.min.js +5 -4
- package/dist/switchCase.js +5 -4
- package/dist/switchCase.min.js +5 -4
- package/dist/switchCase.mjs +5 -4
- package/dist/tap.es.js +5 -4
- package/dist/tap.es.min.js +5 -4
- package/dist/tap.js +5 -4
- package/dist/tap.min.js +5 -4
- package/dist/tap.mjs +5 -4
- package/dist/thunkify.es.js +45 -20
- package/dist/thunkify.es.min.js +6 -5
- package/dist/thunkify.js +45 -20
- package/dist/thunkify.min.js +6 -5
- package/dist/thunkify.mjs +45 -20
- package/dist/transform.es.js +5 -4
- package/dist/transform.es.min.js +5 -4
- package/dist/transform.js +5 -4
- package/dist/transform.min.js +5 -4
- package/dist/transform.mjs +5 -4
- package/dist/tryCatch.es.js +5 -4
- package/dist/tryCatch.es.min.js +5 -4
- package/dist/tryCatch.js +5 -4
- package/dist/tryCatch.min.js +5 -4
- package/dist/tryCatch.mjs +5 -4
- package/dist/x/append.es.js +5 -4
- package/dist/x/append.es.min.js +5 -4
- package/dist/x/append.js +5 -4
- package/dist/x/append.min.js +5 -4
- package/dist/x/append.mjs +5 -4
- package/dist/x/callProp.es.js +5 -4
- package/dist/x/callProp.es.min.js +5 -4
- package/dist/x/callProp.js +5 -4
- package/dist/x/callProp.min.js +5 -4
- package/dist/x/callProp.mjs +5 -4
- package/dist/x/defaultsDeep.es.js +5 -4
- package/dist/x/defaultsDeep.es.min.js +5 -4
- package/dist/x/defaultsDeep.js +5 -4
- package/dist/x/defaultsDeep.min.js +5 -4
- package/dist/x/defaultsDeep.mjs +5 -4
- package/dist/x/differenceWith.es.js +5 -4
- package/dist/x/differenceWith.es.min.js +5 -4
- package/dist/x/differenceWith.js +5 -4
- package/dist/x/differenceWith.min.js +5 -4
- package/dist/x/differenceWith.mjs +5 -4
- package/dist/x/filterOut.es.js +5 -4
- package/dist/x/filterOut.es.min.js +5 -4
- package/dist/x/filterOut.js +5 -4
- package/dist/x/filterOut.min.js +5 -4
- package/dist/x/filterOut.mjs +5 -4
- package/dist/x/find.es.js +5 -4
- package/dist/x/find.es.min.js +5 -4
- package/dist/x/find.js +5 -4
- package/dist/x/find.min.js +5 -4
- package/dist/x/find.mjs +5 -4
- package/dist/x/findIndex.es.js +5 -4
- package/dist/x/findIndex.es.min.js +5 -4
- package/dist/x/findIndex.js +5 -4
- package/dist/x/findIndex.min.js +5 -4
- package/dist/x/findIndex.mjs +5 -4
- package/dist/x/first.es.js +5 -4
- package/dist/x/first.es.min.js +5 -4
- package/dist/x/first.js +5 -4
- package/dist/x/first.min.js +5 -4
- package/dist/x/first.mjs +5 -4
- package/dist/x/flatten.es.js +5 -4
- package/dist/x/flatten.es.min.js +5 -4
- package/dist/x/flatten.js +5 -4
- package/dist/x/flatten.min.js +5 -4
- package/dist/x/flatten.mjs +5 -4
- package/dist/x/groupBy.es.js +5 -4
- package/dist/x/groupBy.es.min.js +5 -4
- package/dist/x/groupBy.js +5 -4
- package/dist/x/groupBy.min.js +5 -4
- package/dist/x/groupBy.mjs +5 -4
- package/dist/x/has.es.js +5 -4
- package/dist/x/has.es.min.js +5 -4
- package/dist/x/has.js +5 -4
- package/dist/x/has.min.js +5 -4
- package/dist/x/has.mjs +5 -4
- package/dist/x/identity.es.js +5 -4
- package/dist/x/identity.es.min.js +5 -4
- package/dist/x/identity.js +5 -4
- package/dist/x/identity.min.js +5 -4
- package/dist/x/identity.mjs +5 -4
- package/dist/x/includes.es.js +5 -4
- package/dist/x/includes.es.min.js +5 -4
- package/dist/x/includes.js +5 -4
- package/dist/x/includes.min.js +5 -4
- package/dist/x/includes.mjs +5 -4
- package/dist/x/isDeepEqual.es.js +5 -4
- package/dist/x/isDeepEqual.es.min.js +5 -4
- package/dist/x/isDeepEqual.js +5 -4
- package/dist/x/isDeepEqual.min.js +5 -4
- package/dist/x/isDeepEqual.mjs +5 -4
- package/dist/x/isEmpty.es.js +5 -4
- package/dist/x/isEmpty.es.min.js +5 -4
- package/dist/x/isEmpty.js +5 -4
- package/dist/x/isEmpty.min.js +5 -4
- package/dist/x/isEmpty.mjs +5 -4
- package/dist/x/isEqual.es.js +5 -4
- package/dist/x/isEqual.es.min.js +5 -4
- package/dist/x/isEqual.js +5 -4
- package/dist/x/isEqual.min.js +5 -4
- package/dist/x/isEqual.mjs +5 -4
- package/dist/x/isFunction.es.js +5 -4
- package/dist/x/isFunction.es.min.js +5 -4
- package/dist/x/isFunction.js +5 -4
- package/dist/x/isFunction.min.js +5 -4
- package/dist/x/isFunction.mjs +5 -4
- package/dist/x/isIn.es.js +5 -4
- package/dist/x/isIn.es.min.js +5 -4
- package/dist/x/isIn.js +5 -4
- package/dist/x/isIn.min.js +5 -4
- package/dist/x/isIn.mjs +5 -4
- package/dist/x/isObject.es.js +5 -4
- package/dist/x/isObject.es.min.js +5 -4
- package/dist/x/isObject.js +5 -4
- package/dist/x/isObject.min.js +5 -4
- package/dist/x/isObject.mjs +5 -4
- package/dist/x/isString.es.js +5 -4
- package/dist/x/isString.es.min.js +5 -4
- package/dist/x/isString.js +5 -4
- package/dist/x/isString.min.js +5 -4
- package/dist/x/isString.mjs +5 -4
- package/dist/x/keys.es.js +5 -4
- package/dist/x/keys.es.min.js +5 -4
- package/dist/x/keys.js +5 -4
- package/dist/x/keys.min.js +5 -4
- package/dist/x/keys.mjs +5 -4
- package/dist/x/last.es.js +5 -4
- package/dist/x/last.es.min.js +5 -4
- package/dist/x/last.js +5 -4
- package/dist/x/last.min.js +5 -4
- package/dist/x/last.mjs +5 -4
- package/dist/x/maxBy.es.js +5 -4
- package/dist/x/maxBy.es.min.js +5 -4
- package/dist/x/maxBy.js +5 -4
- package/dist/x/maxBy.min.js +5 -4
- package/dist/x/maxBy.mjs +5 -4
- package/dist/x/noop.es.js +5 -4
- package/dist/x/noop.es.min.js +5 -4
- package/dist/x/noop.js +5 -4
- package/dist/x/noop.min.js +5 -4
- package/dist/x/noop.mjs +5 -4
- package/dist/x/pluck.es.js +45 -5
- package/dist/x/pluck.es.min.js +6 -5
- package/dist/x/pluck.js +45 -5
- package/dist/x/pluck.min.js +6 -5
- package/dist/x/pluck.mjs +45 -5
- package/dist/x/prepend.es.js +5 -4
- package/dist/x/prepend.es.min.js +5 -4
- package/dist/x/prepend.js +5 -4
- package/dist/x/prepend.min.js +5 -4
- package/dist/x/prepend.mjs +5 -4
- package/dist/x/size.es.js +5 -4
- package/dist/x/size.es.min.js +5 -4
- package/dist/x/size.js +5 -4
- package/dist/x/size.min.js +5 -4
- package/dist/x/size.mjs +5 -4
- package/dist/x/trace.es.js +5 -4
- package/dist/x/trace.es.min.js +5 -4
- package/dist/x/trace.js +5 -4
- package/dist/x/trace.min.js +5 -4
- package/dist/x/trace.mjs +5 -4
- package/dist/x/unionWith.es.js +5 -4
- package/dist/x/unionWith.es.min.js +5 -4
- package/dist/x/unionWith.js +5 -4
- package/dist/x/unionWith.min.js +5 -4
- package/dist/x/unionWith.mjs +5 -4
- package/dist/x/uniq.es.js +5 -4
- package/dist/x/uniq.es.min.js +5 -4
- package/dist/x/uniq.js +5 -4
- package/dist/x/uniq.min.js +5 -4
- package/dist/x/uniq.mjs +5 -4
- package/dist/x/unless.es.js +5 -4
- package/dist/x/unless.es.min.js +5 -4
- package/dist/x/unless.js +5 -4
- package/dist/x/unless.min.js +5 -4
- package/dist/x/unless.mjs +5 -4
- package/dist/x/values.es.js +5 -4
- package/dist/x/values.es.min.js +5 -4
- package/dist/x/values.js +5 -4
- package/dist/x/values.min.js +5 -4
- package/dist/x/values.mjs +5 -4
- package/dist/x/when.es.js +5 -4
- package/dist/x/when.es.min.js +5 -4
- package/dist/x/when.js +5 -4
- package/dist/x/when.min.js +5 -4
- package/dist/x/when.mjs +5 -4
- package/es.js +51 -9
- package/index.js +51 -9
- package/package.json +1 -1
- package/thunkify.js +66 -6
package/LICENSE
CHANGED
|
@@ -1,21 +1,9 @@
|
|
|
1
|
-
The
|
|
1
|
+
The CLOUT Free and Open Source Software License (CFOSS)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
© Richard Yufei Tong, King of Software
|
|
4
4
|
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
11
6
|
|
|
12
|
-
|
|
13
|
-
all copies or substantial portions of the Software.
|
|
7
|
+
1. This permission notice is included in all copies or substantial portions of the Software.
|
|
14
8
|
|
|
15
|
-
THE SOFTWARE IS PROVIDED
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
THE SOFTWARE.
|
|
9
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE, OR IN THE USE OF OR OTHER DEALINGS OF THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -121,7 +121,7 @@ const {
|
|
|
121
121
|
} = rubico
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
-
With [A]synchronous Functional Programming, any function may be asynchronous and return a promise
|
|
124
|
+
With [A]synchronous Functional Programming, any function may be asynchronous and return a promise, and arguments may be promises as well. If a promise is provided to a Rubico operator in argument position, it is resolved for its value before continuing with the operation.
|
|
125
125
|
|
|
126
126
|
```javascript [playground]
|
|
127
127
|
const helloPromise = Promise.resolve('hello')
|
package/_internal/curryArity.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
const areAnyValuesPromises = require('./areAnyValuesPromises')
|
|
2
|
+
const promiseAll = require('./promiseAll')
|
|
1
3
|
const __ = require('./placeholder')
|
|
4
|
+
const curry4 = require('./curry4')
|
|
5
|
+
const curry3 = require('./curry3')
|
|
6
|
+
const funcApply2 = require('./funcApply2')
|
|
2
7
|
|
|
3
8
|
/**
|
|
4
9
|
* @name _curryArity
|
|
@@ -35,7 +40,13 @@ const _curryArity = (arity, func, context, args) => function curried(...curriedA
|
|
|
35
40
|
} else {
|
|
36
41
|
nextArgs.push(arg)
|
|
37
42
|
}
|
|
43
|
+
|
|
38
44
|
if (nextArgs.length == arity) {
|
|
45
|
+
if (areAnyValuesPromises(nextArgs)) {
|
|
46
|
+
return numCurriedPlaceholders == 0
|
|
47
|
+
? promiseAll(nextArgs).then(curry3(funcApply2, func, context, __))
|
|
48
|
+
: promiseAll(nextArgs).then(curry4(curryArity, arity, func, context, __))
|
|
49
|
+
}
|
|
39
50
|
return numCurriedPlaceholders == 0
|
|
40
51
|
? func.apply(context, nextArgs)
|
|
41
52
|
: curryArity(arity, func, context, nextArgs)
|
|
@@ -48,13 +59,22 @@ const _curryArity = (arity, func, context, args) => function curried(...curriedA
|
|
|
48
59
|
numCurriedPlaceholders += 1
|
|
49
60
|
}
|
|
50
61
|
nextArgs.push(curriedArg)
|
|
62
|
+
|
|
51
63
|
if (nextArgs.length == arity) {
|
|
64
|
+
if (areAnyValuesPromises(nextArgs)) {
|
|
65
|
+
return numCurriedPlaceholders == 0
|
|
66
|
+
? promiseAll(nextArgs).then(curry3(funcApply2, func, context, __))
|
|
67
|
+
: promiseAll(nextArgs).then(curry4(curryArity, arity, func, context, __))
|
|
68
|
+
}
|
|
52
69
|
return numCurriedPlaceholders == 0
|
|
53
70
|
? func.apply(context, nextArgs)
|
|
54
71
|
: curryArity(arity, func, context, nextArgs)
|
|
55
72
|
}
|
|
56
73
|
}
|
|
57
|
-
|
|
74
|
+
|
|
75
|
+
return areAnyValuesPromises(nextArgs)
|
|
76
|
+
? promiseAll(nextArgs).then(curry4(curryArity, arity, func, context, __))
|
|
77
|
+
: curryArity(arity, func, context, nextArgs)
|
|
58
78
|
}
|
|
59
79
|
|
|
60
80
|
/**
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name funcApply2
|
|
3
|
+
*
|
|
4
|
+
* @synopsis
|
|
5
|
+
* ```coffeescript [specscript]
|
|
6
|
+
* funcApply2<
|
|
7
|
+
* func function,
|
|
8
|
+
* context object,
|
|
9
|
+
* args Array
|
|
10
|
+
* >(func, args) -> func(...args)
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @description
|
|
14
|
+
* Apply arguments to a function with context.
|
|
15
|
+
*/
|
|
16
|
+
const funcApply2 = (func, context, args) => func.apply(context, args)
|
|
17
|
+
|
|
18
|
+
module.exports = funcApply2
|
package/curry.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
const areAnyValuesPromises = require('./_internal/areAnyValuesPromises')
|
|
2
|
+
const promiseAll = require('./_internal/promiseAll')
|
|
3
|
+
const __ = require('./_internal/placeholder')
|
|
4
|
+
const curry4 = require('./_internal/curry4')
|
|
1
5
|
const curryArity = require('./_internal/curryArity')
|
|
2
6
|
|
|
3
7
|
/**
|
|
@@ -22,15 +26,27 @@ const curryArity = require('./_internal/curryArity')
|
|
|
22
26
|
* ```javascript [playground]
|
|
23
27
|
* const add = (a, b, c) => a + b + c
|
|
24
28
|
*
|
|
25
|
-
* console.log(curry(add, 'a', 'b', 'c'))
|
|
26
|
-
* console.log(curry(add)('a', 'b', 'c'))
|
|
27
|
-
* console.log(curry(add, 'a')('b', 'c'))
|
|
28
|
-
* console.log(curry(add, 'a', 'b')('c'))
|
|
29
|
-
* console.log(curry(add)('a')('b')('c'))
|
|
29
|
+
* console.log(curry(add, 'a', 'b', 'c'))
|
|
30
|
+
* console.log(curry(add)('a', 'b', 'c'))
|
|
31
|
+
* console.log(curry(add, 'a')('b', 'c'))
|
|
32
|
+
* console.log(curry(add, 'a', 'b')('c'))
|
|
33
|
+
* console.log(curry(add)('a')('b')('c'))
|
|
30
34
|
*
|
|
31
|
-
* console.log(curry(add, __, 'b', 'c')('a'))
|
|
32
|
-
* console.log(curry(add, __, __, 'c')('a', 'b'))
|
|
33
|
-
* console.log(curry(add, __, __, 'c')(__, 'b')('a'))
|
|
35
|
+
* console.log(curry(add, __, 'b', 'c')('a'))
|
|
36
|
+
* console.log(curry(add, __, __, 'c')('a', 'b'))
|
|
37
|
+
* console.log(curry(add, __, __, 'c')(__, 'b')('a'))
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* Any promises passed in argument position are resolved for their values before further execution. This only applies to the eager version of the API.
|
|
41
|
+
*
|
|
42
|
+
* ```javascript [playground]
|
|
43
|
+
* const add = (a, b, c) => a + b + c
|
|
44
|
+
*
|
|
45
|
+
* curry(add, Promise.resolve('a'), 'b', 'c').then(console.log)
|
|
46
|
+
*
|
|
47
|
+
* let curried = await curry(add, __, __, Promise.resolve('c'))
|
|
48
|
+
* curried = await curried(__, Promise.resolve('b'))
|
|
49
|
+
* console.log(curried('a'))
|
|
34
50
|
* ```
|
|
35
51
|
*
|
|
36
52
|
* See also:
|
|
@@ -43,7 +59,12 @@ const curryArity = require('./_internal/curryArity')
|
|
|
43
59
|
* * [Transducer.map](/docs/Transducer.map)
|
|
44
60
|
*
|
|
45
61
|
*/
|
|
46
|
-
const curry = (func, ...args) =>
|
|
62
|
+
const curry = (func, ...args) => {
|
|
63
|
+
if (areAnyValuesPromises(args)) {
|
|
64
|
+
return promiseAll(args).then(curry4(curryArity, func.length, func, this, __))
|
|
65
|
+
}
|
|
66
|
+
return curryArity(func.length, func, this, args)
|
|
67
|
+
}
|
|
47
68
|
|
|
48
69
|
/**
|
|
49
70
|
* @name curry.arity
|
|
@@ -62,7 +83,7 @@ const curry = (func, ...args) => curryArity(func.length, func, this, args)
|
|
|
62
83
|
* ```
|
|
63
84
|
*
|
|
64
85
|
* @description
|
|
65
|
-
*
|
|
86
|
+
* [curry](/docs/curry) with specified arity (number of arguments taken by the function) as the first parameter.
|
|
66
87
|
*
|
|
67
88
|
* ```javascript [playground]
|
|
68
89
|
* const add = (a, b, c = 0) => a + b + c
|
|
@@ -81,6 +102,9 @@ const curry = (func, ...args) => curryArity(func.length, func, this, args)
|
|
|
81
102
|
*
|
|
82
103
|
*/
|
|
83
104
|
curry.arity = function curryArity_(arity, func, ...args) {
|
|
105
|
+
if (areAnyValuesPromises(args)) {
|
|
106
|
+
return promiseAll(args).then(curry4(curryArity, arity, func, this, __))
|
|
107
|
+
}
|
|
84
108
|
return curryArity(arity, func, this, args)
|
|
85
109
|
}
|
|
86
110
|
|
|
@@ -101,7 +125,7 @@ curry.arity = function curryArity_(arity, func, ...args) {
|
|
|
101
125
|
* ```
|
|
102
126
|
*
|
|
103
127
|
* @description
|
|
104
|
-
*
|
|
128
|
+
* [curry](/docs/curry) with specified context.
|
|
105
129
|
*
|
|
106
130
|
* ```javascript [playground]
|
|
107
131
|
* class Point {
|
|
@@ -134,6 +158,9 @@ curry.arity = function curryArity_(arity, func, ...args) {
|
|
|
134
158
|
*
|
|
135
159
|
*/
|
|
136
160
|
curry.call = function call(func, context, ...args) {
|
|
161
|
+
if (areAnyValuesPromises(args)) {
|
|
162
|
+
return promiseAll(args).then(curry4(curryArity, func.length, func, context, __))
|
|
163
|
+
}
|
|
137
164
|
return curryArity(func.length, func, context, args)
|
|
138
165
|
}
|
|
139
166
|
|
package/dist/Transducer.es.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* https://
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Rubico v2.8.2
|
|
3
|
+
* https://rubico.land/
|
|
4
|
+
*
|
|
5
|
+
* © Richard Yufei Tong, King of Software
|
|
6
|
+
* Rubico may be freely distributed under the CFOSS license.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
const isPromise = value => value != null && typeof value.then == 'function'
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* https://
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Rubico v2.8.2
|
|
3
|
+
* https://rubico.land/
|
|
4
|
+
*
|
|
5
|
+
* © Richard Yufei Tong, King of Software
|
|
6
|
+
* Rubico may be freely distributed under the CFOSS license.
|
|
6
7
|
*/
|
|
7
8
|
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
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* https://
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Rubico v2.8.2
|
|
3
|
+
* https://rubico.land/
|
|
4
|
+
*
|
|
5
|
+
* © Richard Yufei Tong, King of Software
|
|
6
|
+
* Rubico may be freely distributed under the CFOSS license.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
(function (root, Transducer) {
|
package/dist/Transducer.min.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* https://
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Rubico v2.8.2
|
|
3
|
+
* https://rubico.land/
|
|
4
|
+
*
|
|
5
|
+
* © Richard Yufei Tong, King of Software
|
|
6
|
+
* Rubico may be freely distributed under the CFOSS license.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
!function(n,t){"object"==typeof module?module.exports=t:"function"==typeof define?define(()=>t):n.Transducer=t}("object"==typeof globalThis?globalThis:this,function(){"use strict";const n=n=>null!=n&&"function"==typeof n.then,t=Symbol.for("placeholder"),r=function(n,r,e){return r==t?((n,t)=>function(r){return n(r,t)})(n,e):((n,t)=>function(r){return n(t,r)})(n,r)},e=(e,o)=>function(u,c){const f=o(c);return n(f)?f.then(r(e,u,t)):e(u,f)},o=function(n,r,e,o){return r==t?((n,t,r)=>function(e){return n(e,t,r)})(n,e,o):e==t?((n,t,r)=>function(e){return n(t,e,r)})(n,r,o):((n,t,r)=>function(e){return n(t,r,e)})(n,r,e)},u=(n,t,r)=>function(){return n(t,r)},c=(n,t,r)=>n?t():r(),f=(r,e)=>function(f,i){const a=e(i);return n(a)?a.then(o(c,t,u(r,f,i),(s=f,function(){return s}))):a?r(f,i):f;var s},i=Array.isArray,a=(Object.values,Object.prototype.toString,async function(t,r,e){let o=t.next();if(o.done)return e;for(;!o.done;)e=r(e,o.value),n(e)&&(e=await e),o=t.next();return e}),s=Symbol.iterator,l=Symbol.asyncIterator,h=function(n,r,e,o,u){return r==t?((n,t,r,e)=>function(o){return n(o,t,r,e)})(n,e,o,u):e==t?((n,t,r,e)=>function(o){return n(t,o,r,e)})(n,r,o,u):o==t?((n,t,r,e)=>function(o){return n(t,r,o,e)})(n,r,e,u):((n,t,r,e)=>function(o){return n(t,r,e,o)})(n,r,e,o)},y=async function(t,r,e,o){const u=t.length;for(;++o<u;)e=r(e,t[o],o,t),n(e)&&(e=await e);return e},d=function(n,r,e,o,u,c){return r==t?((n,t,r,e,o)=>function(u){return n(u,t,r,e,o)})(n,e,o,u,c):e==t?((n,t,r,e,o)=>function(u){return n(t,u,r,e,o)})(n,r,o,u,c):o==t?((n,t,r,e,o)=>function(u){return n(t,r,u,e,o)})(n,r,e,u,c):u==t?((n,t,r,e,o)=>function(u){return n(t,r,e,u,o)})(n,r,e,o,c):((n,t,r,e,o)=>function(u){return n(t,r,e,o,u)})(n,r,e,o,u)},p=Object.keys,v=async function(t,r,e,o,u){const c=o.length;for(;++u<c;){const c=o[u];e=r(e,t[c],c,t),n(e)&&(e=await e)}return e},b=async function(t,r,e,o){for(const[u,c]of o)e=r(e,c,u,t),n(e)&&(e=await e);return e},x=function(e,u,c){return i(e)?function(r,e,o){const u=r.length;let c=-1;for(void 0===o&&(o=r[++c]);++c<u;)if(o=e(o,r[c],c,r),n(o))return o.then(h(y,r,e,t,c));return o}(e,u,c):null==e?void 0===c?r(u,e,t):u(c,e):e.constructor==Map?function(r,e,o){const u=r.entries();if(void 0===o){const n=u.next();if(n.done)return o;o=n.value[1]}for(const[c,f]of u)if(o=e(o,f,c,r),n(o))return o.then(h(b,r,e,t,u));return o}(e,u,c):"function"==typeof e[s]?function(r,e,u){let c=r.next();if(c.done)return u;for(void 0===u&&(u=c.value,c=r.next());!c.done;){if(u=e(u,c.value),n(u))return u.then(o(a,r,e,t));c=r.next()}return u}(e[s](),u,c):"function"==typeof e[l]?async function(n,t,r){let e=await n.next();if(e.done)return r;for(void 0===r&&(r=e.value,e=await n.next());!e.done;)r=await t(r,e.value),e=await n.next();return r}(e[l](),u,c):"function"==typeof e.reduce?e.reduce(u,c):"function"==typeof e.chain?e.chain(r(u,c,t)):"function"==typeof e.flatMap?e.flatMap(r(u,c,t)):e.constructor==Object?function(r,e,o){const u=p(r),c=u.length;let f=-1;for(void 0===o&&(o=r[u[++f]]);++f<c;){const c=u[f];if(o=e(o,r[c],c,r),n(o))return o.then(d(v,r,e,t,u,f))}return o}(e,u,c):void 0===c?r(u,e,t):u(c,e)},g=(r,e)=>function(u,c){const f=e(c);return n(f)?f.then(o(x,t,r,u)):x(f,r,u)},w=(t,r)=>function(e,o){const c=r(o);return n(c)?c.then(u(t,e,o)):t(e,o)},j=function(e,o,u,c,f){const i=e(u,f);return n(i)?i.then(r(o,c,t)):o(c,i)},m=function(r,e,o){const u=e(r);return function(e,c){try{const f=u(e,c);return n(f)?f.catch(d(j,o,r,t,e,c)):f}catch(n){return j(o,r,n,e,c)}}},M={map:function(n){return r(e,t,n)},filter:function(n){return r(f,t,n)},flatMap:function(n){return r(g,t,n)},forEach:function(n){return r(w,t,n)},passthrough:function(n){return n},tryCatch:function(n,r){return o(m,t,n,r)}};return M}());
|
package/dist/Transducer.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* https://
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Rubico v2.8.2
|
|
3
|
+
* https://rubico.land/
|
|
4
|
+
*
|
|
5
|
+
* © Richard Yufei Tong, King of Software
|
|
6
|
+
* Rubico may be freely distributed under the CFOSS license.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
const isPromise = value => value != null && typeof value.then == 'function'
|
package/dist/__.es.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* https://
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Rubico v2.8.2
|
|
3
|
+
* https://rubico.land/
|
|
4
|
+
*
|
|
5
|
+
* © Richard Yufei Tong, King of Software
|
|
6
|
+
* Rubico may be freely distributed under the CFOSS license.
|
|
6
7
|
*/
|
|
7
8
|
const __ = Symbol.for('placeholder')
|
|
8
9
|
|
package/dist/__.es.min.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* https://
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Rubico v2.8.2
|
|
3
|
+
* https://rubico.land/
|
|
4
|
+
*
|
|
5
|
+
* © Richard Yufei Tong, King of Software
|
|
6
|
+
* Rubico may be freely distributed under the CFOSS license.
|
|
6
7
|
*/
|
|
7
8
|
const __=Symbol.for("placeholder");export default __;
|
package/dist/__.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* https://
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Rubico v2.8.2
|
|
3
|
+
* https://rubico.land/
|
|
4
|
+
*
|
|
5
|
+
* © Richard Yufei Tong, King of Software
|
|
6
|
+
* Rubico may be freely distributed under the CFOSS license.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
(function (root, __) {
|
package/dist/__.min.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* https://
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Rubico v2.8.2
|
|
3
|
+
* https://rubico.land/
|
|
4
|
+
*
|
|
5
|
+
* © Richard Yufei Tong, King of Software
|
|
6
|
+
* Rubico may be freely distributed under the CFOSS license.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
!function(e,o){"object"==typeof module?module.exports=o:"function"==typeof define?define(()=>o):e.__=o}("object"==typeof globalThis?globalThis:this,function(){"use strict";return Symbol.for("placeholder")}());
|
package/dist/__.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* https://
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Rubico v2.8.2
|
|
3
|
+
* https://rubico.land/
|
|
4
|
+
*
|
|
5
|
+
* © Richard Yufei Tong, King of Software
|
|
6
|
+
* Rubico may be freely distributed under the CFOSS license.
|
|
6
7
|
*/
|
|
7
8
|
const __ = Symbol.for('placeholder')
|
|
8
9
|
|
package/dist/all.es.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* https://
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Rubico v2.8.2
|
|
3
|
+
* https://rubico.land/
|
|
4
|
+
*
|
|
5
|
+
* © Richard Yufei Tong, King of Software
|
|
6
|
+
* Rubico may be freely distributed under the CFOSS license.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
const isPromise = value => value != null && typeof value.then == 'function'
|
package/dist/all.es.min.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* https://
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Rubico v2.8.2
|
|
3
|
+
* https://rubico.land/
|
|
4
|
+
*
|
|
5
|
+
* © Richard Yufei Tong, King of Software
|
|
6
|
+
* Rubico may be freely distributed under the CFOSS license.
|
|
6
7
|
*/
|
|
7
8
|
const isPromise=r=>null!=r&&"function"==typeof r.then,isArray=Array.isArray,areAnyValuesPromises=function(r){if(isArray(r)){const n=r.length;let e=-1;for(;++e<n;){const n=r[e];if(isPromise(n))return!0}return!1}for(const n in r){const e=r[n];if(isPromise(e))return!0}return!1},areAllValuesNonfunctions=function(r){if(isArray(r)){const n=r.length;let e=-1;for(;++e<n;)if("function"==typeof r[e])return!1;return!0}for(const n in r)if("function"==typeof r[n])return!1;return!0},promiseAll=Promise.all.bind(Promise),promiseObjectAllExecutor=r=>function(n){const e={};let t=0;for(const o in r){const u=r[o];isPromise(u)?(t+=1,u.then((r=>function(o){e[r]=o,t-=1,0==t&&n(e)})(o))):e[o]=u}0==t&&n(e)},promiseObjectAll=r=>new Promise(promiseObjectAllExecutor(r)),__=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],s="function"==typeof e?e(...n):e;isPromise(s)&&(u=!0),t[o]=s}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],s="function"==typeof u?u(...n):u;isPromise(s)?t.push(s.then(curry3(objectSet,e,o,__))):e[o]=s}return 0==t.length?e:promiseAll(t).then(always(e))},_allValues=function(r){return isArray(r)?areAnyValuesPromises(r)?promiseAll(r):r:areAnyValuesPromises(r)?promiseObjectAll(r):r},all=function(...r){if(1==r.length){const n=r[0];return isPromise(n)?n.then(_allValues):areAllValuesNonfunctions(n)?_allValues(n):isArray(n)?curryArgs2(functionArrayAll,n,__):curryArgs2(functionObjectAll,n,__)}const n=r[r.length-1],e=r.slice(0,-1);return areAnyValuesPromises(e)?isArray(n)?promiseAll(e).then(curry2(functionArrayAll,n,__)):promiseAll(e).then(curry2(functionObjectAll,n,__)):isArray(n)?functionArrayAll(n,e):functionObjectAll(n,e)};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
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* https://
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Rubico v2.8.2
|
|
3
|
+
* https://rubico.land/
|
|
4
|
+
*
|
|
5
|
+
* © Richard Yufei Tong, King of Software
|
|
6
|
+
* Rubico may be freely distributed under the CFOSS license.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
(function (root, all) {
|
package/dist/all.min.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* https://
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Rubico v2.8.2
|
|
3
|
+
* https://rubico.land/
|
|
4
|
+
*
|
|
5
|
+
* © Richard Yufei Tong, King of Software
|
|
6
|
+
* Rubico may be freely distributed under the CFOSS license.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
!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=Array.isArray,r=function(r){if(t(r)){const t=r.length;let o=-1;for(;++o<t;){const t=r[o];if(n(t))return!0}return!1}for(const t in r){const o=r[t];if(n(o))return!0}return!1},o=Promise.all.bind(Promise),e=t=>new Promise((t=>function(r){const o={};let e=0;for(const u in t){const c=t[u];n(c)?(e+=1,c.then((n=>function(t){o[n]=t,e-=1,0==e&&r(o)})(u))):o[u]=c}0==e&&r(o)})(t)),u=Symbol.for("placeholder"),c=function(n,t,r){return t==u?((n,t)=>function(r){return n(r,t)})(n,r):((n,t)=>function(r){return n(t,r)})(n,t)},f=function(n,t,r){return t==u?((n,t)=>function(...r){return n(r,t)})(n,r):((n,t)=>function(...r){return n(t,r)})(n,t)},i=function(t,r){const e=t.length,u=Array(e);let c=-1,f=!1;for(;++c<e;){const o=t[c],e="function"==typeof o?o(...r):o;n(e)&&(f=!0),u[c]=e}return f?o(u):u},s=(t,r)=>function(...o){const e=t(...o);return n(e)?e.then(r):r(e)},l=function(n,t,r,o){return t==u?((n,t,r)=>function(o){return n(o,t,r)})(n,r,o):r==u?((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)},h=function(n,t,r,o,e){return t==u?((n,t,r,o)=>function(e){return n(e,t,r,o)})(n,r,o,e):r==u?((n,t,r,o)=>function(e){return n(t,e,r,o)})(n,t,o,e):o==u?((n,t,r,o)=>function(e){return n(t,r,e,o)})(n,t,r,e):((n,t,r,o)=>function(e){return n(t,r,o,e)})(n,t,r,o)},p=function(n,t,r){return n[t]=r,n},y=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,e=[];let c=-1;for(;++c<o;){const o=t[c](...r);if(n(o))return o.then(s(l(p,e,c,u),h(y,t,r,u,c)));e[c]=o}return e},g=function(t,r){const e={},c=[];for(const o in t){const f=t[o],i="function"==typeof f?f(...r):f;n(i)?c.push(i.then(l(p,e,o,u))):e[o]=i}return 0==c.length?e:o(c).then((f=e,function(){return f}));var f},b=function(n){return t(n)?r(n)?o(n):n:r(n)?e(n):n},d=function(...e){if(1==e.length){const r=e[0];return n(r)?r.then(b):function(n){if(t(n)){const t=n.length;let r=-1;for(;++r<t;)if("function"==typeof n[r])return!1;return!0}for(const t in n)if("function"==typeof n[t])return!1;return!0}(r)?b(r):t(r)?f(i,r,u):f(g,r,u)}const s=e[e.length-1],l=e.slice(0,-1);return r(l)?t(s)?o(l).then(c(i,s,u)):o(l).then(c(g,s,u)):t(s)?i(s,l):g(s,l)};return d.series=function(...n){const t=n.pop();return 0==n.length?f(a,t,u):r(n)?o(n).then(c(a,t,u)):a(t,n)},d}());
|
package/dist/all.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* https://
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Rubico v2.8.2
|
|
3
|
+
* https://rubico.land/
|
|
4
|
+
*
|
|
5
|
+
* © Richard Yufei Tong, King of Software
|
|
6
|
+
* Rubico may be freely distributed under the CFOSS license.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
const isPromise = value => value != null && typeof value.then == 'function'
|
package/dist/always.es.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* https://
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Rubico v2.8.2
|
|
3
|
+
* https://rubico.land/
|
|
4
|
+
*
|
|
5
|
+
* © Richard Yufei Tong, King of Software
|
|
6
|
+
* Rubico may be freely distributed under the CFOSS license.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
const always = value => function getter() { return value }
|
package/dist/always.es.min.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* https://
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Rubico v2.8.2
|
|
3
|
+
* https://rubico.land/
|
|
4
|
+
*
|
|
5
|
+
* © Richard Yufei Tong, King of Software
|
|
6
|
+
* Rubico may be freely distributed under the CFOSS license.
|
|
6
7
|
*/
|
|
7
8
|
const always=a=>function(){return a};export default always;
|
package/dist/always.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* https://
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Rubico v2.8.2
|
|
3
|
+
* https://rubico.land/
|
|
4
|
+
*
|
|
5
|
+
* © Richard Yufei Tong, King of Software
|
|
6
|
+
* Rubico may be freely distributed under the CFOSS license.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
(function (root, always) {
|
package/dist/always.min.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* https://
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Rubico v2.8.2
|
|
3
|
+
* https://rubico.land/
|
|
4
|
+
*
|
|
5
|
+
* © Richard Yufei Tong, King of Software
|
|
6
|
+
* Rubico may be freely distributed under the CFOSS license.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
!function(e,t){"object"==typeof module?module.exports=t:"function"==typeof define?define(()=>t):e.always=t}("object"==typeof globalThis?globalThis:this,function(){"use strict";return e=>function(){return e}}());
|
package/dist/always.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* https://
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Rubico v2.8.2
|
|
3
|
+
* https://rubico.land/
|
|
4
|
+
*
|
|
5
|
+
* © Richard Yufei Tong, King of Software
|
|
6
|
+
* Rubico may be freely distributed under the CFOSS license.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
const always = value => function getter() { return value }
|
package/dist/and.es.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* https://
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Rubico v2.8.2
|
|
3
|
+
* https://rubico.land/
|
|
4
|
+
*
|
|
5
|
+
* © Richard Yufei Tong, King of Software
|
|
6
|
+
* Rubico may be freely distributed under the CFOSS license.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
const promiseAll = Promise.all.bind(Promise)
|
package/dist/and.es.min.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* https://
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Rubico v2.8.2
|
|
3
|
+
* https://rubico.land/
|
|
4
|
+
*
|
|
5
|
+
* © Richard Yufei Tong, King of Software
|
|
6
|
+
* Rubico may be freely distributed under the CFOSS license.
|
|
6
7
|
*/
|
|
7
8
|
const promiseAll=Promise.all.bind(Promise),isPromise=r=>null!=r&&"function"==typeof r.then,isArray=Array.isArray,areAnyValuesPromises=function(r){if(isArray(r)){const n=r.length;let e=-1;for(;++e<n;){const n=r[e];if(isPromise(n))return!0}return!1}for(const n in r){const e=r[n];if(isPromise(e))return!0}return!1},__=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)},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)},thunkConditional=(r,n,e)=>r?n():e(),areAllValuesNonfunctions=function(r){if(isArray(r)){const n=r.length;let e=-1;for(;++e<n;)if("function"==typeof r[e])return!1;return!0}for(const n in r)if("function"==typeof r[n])return!1;return!0},thunkify2=(r,n,e)=>function(){return r(n,e)},thunkify3=(r,n,e,t)=>function(){return r(n,e,t)},always=r=>function(){return r},areAllValuesTruthy=function(r,n){const e=r.length;for(;++n<e;){const e=r[n];if(isPromise(e))return e.then(curry3(thunkConditional,__,thunkify2(areAllValuesTruthy,r,n),always(!1)));if(!e)return!1}return!0},asyncArePredicatesAllTruthy=async function(r,n,e){const t=n.length;for(;++e<t;){let t=n[e];if("function"==typeof t&&(t=t(...r)),isPromise(t)&&(t=await t),!t)return!1}return!0},areAllPredicatesTruthy=function(r,n){const e=n.length;let t=-1;for(;++t<e;){let e=n[t];if("function"==typeof e&&(e=e(...r)),isPromise(e))return e.then(curry3(thunkConditional,__,thunkify3(asyncArePredicatesAllTruthy,r,n,t),always(!1)));if(!e)return!1}return!0},and=function(...r){const n=r.pop();return areAllValuesNonfunctions(n)?areAllValuesTruthy(n,-1):0==r.length?curryArgs2(areAllPredicatesTruthy,__,n):areAnyValuesPromises(r)?promiseAll(r).then(curry2(areAllPredicatesTruthy,__,n)):areAllPredicatesTruthy(r,n)};export default and;
|
package/dist/and.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* https://
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Rubico v2.8.2
|
|
3
|
+
* https://rubico.land/
|
|
4
|
+
*
|
|
5
|
+
* © Richard Yufei Tong, King of Software
|
|
6
|
+
* Rubico may be freely distributed under the CFOSS license.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
(function (root, and) {
|
package/dist/and.min.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* https://
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Rubico v2.8.2
|
|
3
|
+
* https://rubico.land/
|
|
4
|
+
*
|
|
5
|
+
* © Richard Yufei Tong, King of Software
|
|
6
|
+
* Rubico may be freely distributed under the CFOSS license.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
!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=Array.isArray,e=Symbol.for("placeholder"),o=function(n,t,r,o){return t==e?((n,t,r)=>function(e){return n(e,t,r)})(n,r,o):r==e?((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,r)},u=(n,t,r)=>n?t():r(),f=(n,t,r)=>function(){return n(t,r)},i=(n,t,r,e)=>function(){return n(t,r,e)},c=n=>function(){return n},l=function(n,r){const i=n.length;for(;++r<i;){const i=n[r];if(t(i))return i.then(o(u,e,f(l,n,r),c(!1)));if(!i)return!1}return!0},s=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},h=function(n,r){const f=r.length;let l=-1;for(;++l<f;){let f=r[l];if("function"==typeof f&&(f=f(...n)),t(f))return f.then(o(u,e,i(s,n,r,l),c(!1)));if(!f)return!1}return!0};return function(...o){const u=o.pop();return function(n){if(r(n)){const t=n.length;let r=-1;for(;++r<t;)if("function"==typeof n[r])return!1;return!0}for(const t in n)if("function"==typeof n[t])return!1;return!0}(u)?l(u,-1):0==o.length?(f=h,c=u,(i=e)==e?((n,t)=>function(...r){return n(r,t)})(f,c):((n,t)=>function(...r){return n(t,r)})(f,i)):function(n){if(r(n)){const r=n.length;let e=-1;for(;++e<r;){const r=n[e];if(t(r))return!0}return!1}for(const r in n){const e=n[r];if(t(e))return!0}return!1}(o)?n(o).then(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)}(h,e,u)):h(o,u);var f,i,c}}());
|
package/dist/and.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* https://
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Rubico v2.8.2
|
|
3
|
+
* https://rubico.land/
|
|
4
|
+
*
|
|
5
|
+
* © Richard Yufei Tong, King of Software
|
|
6
|
+
* Rubico may be freely distributed under the CFOSS license.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
const promiseAll = Promise.all.bind(Promise)
|
package/dist/assign.es.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* https://
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Rubico v2.8.2
|
|
3
|
+
* https://rubico.land/
|
|
4
|
+
*
|
|
5
|
+
* © Richard Yufei Tong, King of Software
|
|
6
|
+
* Rubico may be freely distributed under the CFOSS license.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
const isPromise = value => value != null && typeof value.then == 'function'
|