rubico 2.4.0 → 2.4.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/README.md +6 -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 +7 -12
- package/dist/every.es.min.js +2 -2
- package/dist/every.js +7 -12
- package/dist/every.min.js +2 -2
- package/dist/every.mjs +7 -12
- package/dist/filter.es.js +5 -6
- package/dist/filter.es.min.js +2 -2
- package/dist/filter.js +5 -6
- package/dist/filter.min.js +2 -2
- package/dist/filter.mjs +5 -6
- package/dist/flatMap.es.js +7 -9
- package/dist/flatMap.es.min.js +2 -2
- package/dist/flatMap.js +7 -9
- package/dist/flatMap.min.js +2 -2
- package/dist/flatMap.mjs +7 -9
- package/dist/forEach.es.js +1 -1
- package/dist/forEach.es.min.js +1 -1
- package/dist/forEach.js +1 -1
- package/dist/forEach.min.js +1 -1
- package/dist/forEach.mjs +1 -1
- 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 +13 -21
- package/dist/map.es.min.js +2 -2
- package/dist/map.js +13 -21
- package/dist/map.min.js +2 -2
- package/dist/map.mjs +13 -21
- 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 +35 -56
- package/dist/rubico.es.min.js +2 -2
- package/dist/rubico.global.js +35 -56
- package/dist/rubico.global.min.js +2 -2
- package/dist/rubico.js +35 -56
- package/dist/rubico.min.js +2 -2
- package/dist/rubico.mjs +35 -56
- 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 +7 -12
- package/dist/some.es.min.js +2 -2
- package/dist/some.js +7 -12
- package/dist/some.min.js +2 -2
- package/dist/some.mjs +7 -12
- 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 +5 -6
- package/dist/x/filterOut.es.min.js +2 -2
- package/dist/x/filterOut.js +5 -6
- package/dist/x/filterOut.min.js +2 -2
- package/dist/x/filterOut.mjs +5 -6
- 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 +7 -9
- package/dist/x/flatten.es.min.js +2 -2
- package/dist/x/flatten.js +7 -9
- package/dist/x/flatten.min.js +2 -2
- package/dist/x/flatten.mjs +7 -9
- 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 +13 -21
- package/dist/x/pluck.es.min.js +2 -2
- package/dist/x/pluck.js +13 -21
- package/dist/x/pluck.min.js +2 -2
- package/dist/x/pluck.mjs +13 -21
- 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 +35 -56
- package/every.js +6 -11
- package/filter.js +4 -6
- package/flatMap.js +6 -8
- package/index.js +35 -56
- package/map.js +12 -21
- package/package.json +8 -7
- package/some.js +6 -12
package/dist/rubico.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.4.
|
|
2
|
+
* rubico v2.4.2
|
|
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.
|
|
@@ -852,17 +852,13 @@ const _map = function (value, mapper) {
|
|
|
852
852
|
return mapper(value)
|
|
853
853
|
}
|
|
854
854
|
|
|
855
|
-
const map = (
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
return curry2(_map, __, mapper)
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
const collection = args[0]
|
|
862
|
-
if (isPromise(collection)) {
|
|
863
|
-
return collection.then(curry2(_map, __, mapper))
|
|
855
|
+
const map = function (arg0, arg1) {
|
|
856
|
+
if (typeof arg0 == 'function') {
|
|
857
|
+
return curry2(_map, __, arg0)
|
|
864
858
|
}
|
|
865
|
-
return
|
|
859
|
+
return isPromise(arg0)
|
|
860
|
+
? arg0.then(curry2(_map, __, arg1))
|
|
861
|
+
: _map(arg0, arg1)
|
|
866
862
|
}
|
|
867
863
|
|
|
868
864
|
// _mapEntries(value Object|Map, mapper function) -> Object|Map
|
|
@@ -879,17 +875,13 @@ const _mapEntries = (value, mapper) => {
|
|
|
879
875
|
throw new TypeError('value is not an Object or Map')
|
|
880
876
|
}
|
|
881
877
|
|
|
882
|
-
map.entries = function mapEntries(
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
return curry2(_mapEntries, __, mapper)
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
const collection = args[0]
|
|
889
|
-
if (isPromise(collection)) {
|
|
890
|
-
return collection.then(curry2(_mapEntries, __, mapper))
|
|
878
|
+
map.entries = function mapEntries(arg0, arg1) {
|
|
879
|
+
if (typeof arg0 == 'function') {
|
|
880
|
+
return curry2(_mapEntries, __, arg0)
|
|
891
881
|
}
|
|
892
|
-
return
|
|
882
|
+
return isPromise(arg0)
|
|
883
|
+
? arg0.then(curry2(_mapEntries, __, arg1))
|
|
884
|
+
: _mapEntries(arg0, arg1)
|
|
893
885
|
}
|
|
894
886
|
|
|
895
887
|
map.series = mapper => function mappingInSeries(value) {
|
|
@@ -1099,12 +1091,11 @@ const _filter = function (value, predicate) {
|
|
|
1099
1091
|
return value
|
|
1100
1092
|
}
|
|
1101
1093
|
|
|
1102
|
-
const filter = function (
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
return curry2(_filter, __, predicate)
|
|
1094
|
+
const filter = function (arg0, arg1) {
|
|
1095
|
+
if (typeof arg0 == 'function') {
|
|
1096
|
+
return curry2(_filter, __, arg0)
|
|
1106
1097
|
}
|
|
1107
|
-
return _filter(
|
|
1098
|
+
return _filter(arg0, arg1)
|
|
1108
1099
|
}
|
|
1109
1100
|
|
|
1110
1101
|
const objectValues = Object.values
|
|
@@ -1862,15 +1853,13 @@ const _flatMap = function (value, flatMapper) {
|
|
|
1862
1853
|
return flatMapper(value)
|
|
1863
1854
|
}
|
|
1864
1855
|
|
|
1865
|
-
const flatMap = (
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
return curry2(_flatMap, __, flatMapper)
|
|
1856
|
+
const flatMap = (arg0, arg1) => {
|
|
1857
|
+
if (typeof arg0 == 'function') {
|
|
1858
|
+
return curry2(_flatMap, __, arg0)
|
|
1869
1859
|
}
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
: _flatMap(args[0], flatMapper)
|
|
1860
|
+
return isPromise(arg0)
|
|
1861
|
+
? arg0.then(curry2(_flatMap, __, arg1))
|
|
1862
|
+
: _flatMap(arg0, arg1)
|
|
1874
1863
|
}
|
|
1875
1864
|
|
|
1876
1865
|
const arrayForEach = function (array, callback) {
|
|
@@ -2196,18 +2185,13 @@ const _some = function (collection, predicate) {
|
|
|
2196
2185
|
return predicate(collection)
|
|
2197
2186
|
}
|
|
2198
2187
|
|
|
2199
|
-
const some = function (
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
return curry2(_some, __, predicate)
|
|
2203
|
-
}
|
|
2204
|
-
|
|
2205
|
-
const collection = args[0]
|
|
2206
|
-
if (isPromise(collection)) {
|
|
2207
|
-
return collection.then(curry2(_some, __, predicate))
|
|
2188
|
+
const some = function (arg0, arg1) {
|
|
2189
|
+
if (typeof arg0 == 'function') {
|
|
2190
|
+
return curry2(_some, __, arg0)
|
|
2208
2191
|
}
|
|
2209
|
-
|
|
2210
|
-
|
|
2192
|
+
return isPromise(arg0)
|
|
2193
|
+
? arg0.then(curry2(_some, __, arg1))
|
|
2194
|
+
: _some(arg0, arg1)
|
|
2211
2195
|
}
|
|
2212
2196
|
|
|
2213
2197
|
const arrayEvery = function (array, predicate) {
|
|
@@ -2308,18 +2292,13 @@ const _every = function (collection, predicate) {
|
|
|
2308
2292
|
return predicate(collection)
|
|
2309
2293
|
}
|
|
2310
2294
|
|
|
2311
|
-
const every = function (
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
return curry2(_every, __, predicate)
|
|
2315
|
-
}
|
|
2316
|
-
|
|
2317
|
-
const collection = args[0]
|
|
2318
|
-
if (isPromise(collection)) {
|
|
2319
|
-
return collection.then(curry2(_every, __, predicate))
|
|
2295
|
+
const every = function (arg0, arg1) {
|
|
2296
|
+
if (typeof arg0 == 'function') {
|
|
2297
|
+
return curry2(_every, __, arg0)
|
|
2320
2298
|
}
|
|
2321
|
-
|
|
2322
|
-
|
|
2299
|
+
return isPromise(arg0)
|
|
2300
|
+
? arg0.then(curry2(_every, __, arg1))
|
|
2301
|
+
: _every(arg0, arg1)
|
|
2323
2302
|
}
|
|
2324
2303
|
|
|
2325
2304
|
const areAllValuesTruthy = function (predicates, index) {
|
package/dist/rubico.min.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.4.
|
|
2
|
+
* rubico v2.4.2
|
|
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.rubico=t}("object"==typeof globalThis?globalThis:this,function(){"use strict";const n=n=>null!=n&&"function"==typeof n.then,t=function(t){const e=t.length;let o=-1;for(;++o<e;){const e=t[o];if(n(e))return!0}return!1},e=Promise.all.bind(Promise),o=(t,e)=>function(...o){const r=t(...o);return n(r)?r.then(e):e(r)},r=(n,t)=>n(...t),u=Symbol.for("placeholder"),c=function(n,t,e){return t==u?((n,t)=>function(e){return n(e,t)})(n,e):((n,t)=>function(e){return n(t,e)})(n,t)},f=n=>function(){return n},i=(n,t)=>function(){return n(...t)},s=(n,t,e)=>n?t():e(),l=function(n,t,e,o){return t==u?((n,t,e)=>function(o){return n(o,t,e)})(n,e,o):e==u?((n,t,e)=>function(o){return n(t,o,e)})(n,t,o):((n,t,e)=>function(o){return n(t,e,o)})(n,t,e)},h=function(n,t,e){return t==u?((n,t,e)=>function(...e){return n(e,t)})(n,e):((n,t,e)=>function(...e){return n(t,e)})(n,t)},a=function(t,e){const o=t[0],r=e(...t);return n(r)?r.then(f(o)):o},p=function(...n){const t=n.pop();return 0==n.length?h(a,u,t):a(n,t)};p.if=(t,e)=>function(...o){const r=t(...o);if(n(r))return r.then(l(s,u,i(p(e),o),f(o[0])));if(r){const t=e(...o);if(n(t))return t.then(f(o[0]))}return o[0]};const y=Array.isArray,d=function(t,o){const r=t.length,u=Array(r);let c=-1,f=!1;for(;++c<r;){const e=t[c](...o);n(e)&&(f=!0),u[c]=e}return f?e(u):u},g=function(n,t,e,o,r){return t==u?((n,t,e,o)=>function(r){return n(r,t,e,o)})(n,e,o,r):e==u?((n,t,e,o)=>function(r){return n(t,r,e,o)})(n,t,o,r):o==u?((n,t,e,o)=>function(r){return n(t,e,r,o)})(n,t,e,r):((n,t,e,o)=>function(r){return n(t,e,o,r)})(n,t,e,o)},w=function(n,t,e){return n[t]=e,n},v=async function(t,e,o,r){const u=t.length;for(;++r<u;){const u=t[r](...e);o[r]=n(u)?await u:u}return o},b=function(t,e){const r=t.length,c=[];let f=-1;for(;++f<r;){const r=t[f](...e);if(n(r))return r.then(o(l(w,c,f,u),g(v,t,e,u,f)));c[f]=r}return c},j=function(t,o){const r={},c=[];for(const e in t){const f=t[e](...o);n(f)?c.push(f.then(l(w,r,e,u))):r[e]=f}return 0==c.length?r:e(c).then(f(r))},x=function(...n){const o=n.pop();return 0==n.length?y(o)?h(d,o,u):h(j,o,u):t(n)?y(o)?e(n).then(c(d,o,u)):e(n).then(c(j,o,u)):y(o)?d(o,n):j(o,n)};x.series=function(...n){const o=n.pop();return 0==n.length?h(b,o,u):t(n)?e(n).then(c(b,o,u)):b(o,n)};const S=Object.assign,M=function(t,e){const o=j(e,[t]);return n(o)?o.then(l(S,{},t,u)):{...t,...o}},m=function(n,t,e){return n(t,...e)},O=function(t,e,o){try{const r=t(...o);return n(r)?r.catch(l(m,e,u,o)):r}catch(n){return e(n,...o)}},A=(n,t,e,o)=>function(){return n(t,e,o)},z=function(t,e,o){const r=t.length-1;for(;(o+=2)<r;){const r=t[o],c=t[o+1],h="function"==typeof r?r(...e):r;if(n(h))return h.then(l(s,u,"function"==typeof c?i(c,e):f(c),A(z,t,e,o)));if(h)return"function"==typeof c?c(...e):c}if(o==t.length)return;const c=t[r];return"function"==typeof c?c(...e):c},E=function(n){const t=n.length;let e=-1;for(;++e<t;)if("function"==typeof n[e])return!1;return!0},I=(n,t,e)=>function(){return n(t,e)},D=function(t,e){const o=t.length,r=o-1;for(;(e+=2)<r;){const o=t[e],r=t[e+1];if(n(o))return o.then(l(s,u,f(r),I(D,t,e)));if(o)return r}if(e!=o)return t[e]},P=Symbol.iterator,T=(n,t)=>({toString:()=>"[object MappingIterator]",[P](){return this},next(){const e=n.next();return e.done?e:{value:t(e.value),done:!1}}}),B=n=>({value:n,done:!1}),$=Symbol.asyncIterator,k=(t,e)=>({[$](){return this},async next(){const o=await t.next();if(o.done)return o;const r=e(o.value);return n(r)?r.then(B):{value:r,done:!1}}}),C=function(t,o){const r=t.length,u=Array(r);let c=-1,f=!1;for(;++c<r;){const e=o(t[c],c,t);n(e)&&(f=!0),u[c]=e}return f?e(u):u},_=(n,t,e)=>n[t](e),q=function(t,o){const r=new Set,c=[];for(const e of t){const f=o(e,e,t);n(f)?c.push(f.then(l(_,r,"add",u))):r.add(f)}return 0==c.length?r:e(c).then(f(r))},F=(n,t,e,o)=>n[t](e,o),R=t=>new Promise((t=>function(e){const o={};let r=0;for(const u in t){const c=t[u];n(c)?(r+=1,c.then((n=>function(t){o[n]=t,r-=1,0==r&&e(o)})(u))):o[u]=c}0==r&&e(o)})(t)),V=function(t,e){const o={};let r=!1;for(const u in t){const c=e(t[u],u,t);n(c)&&(r=!0),o[u]=c}return r?R(o):o},G=async function(t,e,o,r){const u=t.length;for(;++r<u;){const u=e(t[r],r);o[r]=n(u)?await u:u}return o},H=n=>function(...t){return n(...t),t[0]},J=Promise.race.bind(Promise),K=async function(t,o,r,u,c,f){const i=t.length;for(;++c<i;){f.size>=r&&await J(f);const e=o(t[c]);if(n(e)){const n=e.then(H((()=>f.delete(n))));f.add(n),u[c]=n}else u[c]=e}return e(u)},L=(n,t,e)=>function(...o){const r=e.length,c=o.length,f=[];let i=-1,s=-1,l=0;for(;++i<r;){const r=e[i];if(r==u&&(s+=1)<c){const n=o[s];n==u&&(l+=1),f.push(n)}else f.push(r);if(f.length==n)return 0==l?t(...f):N(n,t,f)}for(;++s<c;){const e=o[s];if(e==u&&(l+=1),f.push(e),f.length==n)return 0==l?t(...f):N(n,t,f)}return N(n,t,f)},N=function(n,t,e){const o=e.length;if(o<n)return L(n,t,e);let r=-1;for(;++r<o;){if(e[r]==u)return L(n,t,e)}return t(...e)},Q=n=>function([t,e]){return n(t,e)},U=function(n,t,e){return n.set(t,e)},W=function(t,o){const r=new Map,u=[];return t.forEach(((t,e,o)=>function(r,u){const c=t([u,r]);n(c)?o.push(c.then(Q(N(3,U,[e])))):e.set(c[0],c[1])})(o,r,u)),0==u.length?r:e(u).then(f(r))},X=function(t,o){return y(t)?C(t,o):null==t?t:"function"==typeof t.then?t.then(o):"function"==typeof t.map?t.map(o):"string"==typeof t||t.constructor==String?function(t,e){const o=C(t,e);return n(o)?o.then(l(_,u,"join","")):o.join("")}(t,o):t.constructor==Set?q(t,o):t.constructor==Map?function(t,o){const r=new Map,c=[];for(const[e,f]of t){const i=o(f,e,t);n(i)?c.push(i.then(g(F,r,"set",e,u))):r.set(e,i)}return 0==c.length?r:e(c).then(f(r))}(t,o):"function"==typeof t[P]?T(t[P](),o):"function"==typeof t[$]?k(t[$](),o):t.constructor==Object?V(t,o):o(t)},Y=(...t)=>{const e=t.pop();if(0==t.length)return c(X,u,e);const o=t[0];return n(o)?o.then(c(X,u,e)):X(o,e)},Z=(t,o)=>{if(null==t)throw new TypeError("value is not an Object or Map");if(t.constructor==Object)return function(t,o){const r={},u=[];for(const e in t){const c=o([e,t[e]]);n(c)?u.push(c.then(Q(N(3,w,[r])))):r[c[0]]=c[1]}return 0==u.length?r:e(u).then(f(r))}(t,o);if(t.constructor==Map)return W(t,o);throw new TypeError("value is not an Object or Map")};Y.entries=function(...t){const e=t.pop();if(0==t.length)return c(Z,u,e);const o=t[0];return n(o)?o.then(c(Z,u,e)):Z(o,e)},Y.series=t=>function(e){if(y(e))return function(t,e){const r=t.length,c=Array(r);let f=-1;for(;++f<r;){const r=e(t[f],f);if(n(r))return r.then(o(l(w,c,f,u),g(G,t,e,u,f)));c[f]=r}return c}(e,t);throw new TypeError(`${e} is not an Array`)},Y.pool=(t,e)=>function(o){if(y(o))return function(t,e,o){const r=t.length,u=Array(r);let c=-1;for(;++c<r;){const r=e(t[c]);if(n(r)){const n=new Set,f=r.then(H((()=>n.delete(f))));return n.add(f),u[c]=f,K(t,e,o,u,c,n)}u[c]=r}return u}(o,e,t);throw new TypeError(`${o} is not an Array`)};const nn=(n,t)=>({[P](){return this},next(){let e=n.next();for(;!e.done;){const{value:o}=e;if(t(o))return{value:o,done:!1};e=n.next()}return e}}),tn=(t,e)=>({isAsyncIteratorDone:!1,[$](){return this},async next(){for(;!this.isAsyncIteratorDone;){const{value:o,done:r}=await t.next();if(r)this.isAsyncIteratorDone=!0;else{const t=e(o);if(n(t)?await t:t)return{value:o,done:!1}}}return{value:void 0,done:!0}}}),en=function(n,t,e,o){const r=t.length;let u=n.length-1;for(;++o<r;)n[++u]=e(t[o],o,n);return n},on=function(n,t,e,o){const r=n.length;let u=-1;for(;++e<r;)o[++u]&&t.push(n[e]);return t},rn=function(t,o){const r=t.length,c=[];let f=-1,i=-1;for(;++f<r;){const r=t[f],s=o(r,f,t);if(n(s))return e(en([s],t,o,f)).then(g(on,t,c,f-1,u));s&&(c[++i]=r)}return c},un=(n,t)=>function(){return n(t)},cn=function(){},fn=(n,t,e,o,r)=>function(){return n(t,e,o,r)},sn=function(n,t,e,o){o&&(n[t]=e)},ln=function(t,o){return y(t)?rn(t,o):null==t?t:"string"==typeof t||t.constructor==String?function(t,e){const o=rn(t,e);return n(o)?o.then(l(_,u,"join","")):o.join("")}(t,o):t.constructor==Set?function(t,o){const r=new Set,c=r.add.bind(r),i=[];for(const e of t){const f=o(e,e,t);n(f)?i.push(f.then(l(s,u,un(c,e),cn))):f&&r.add(e)}return 0==i.length?r:e(i).then(f(r))}(t,o):t.constructor==Map?function(t,o){const r=new Map,c=[];for(const[e,f]of t){const i=o(f,e,t);n(i)?c.push(i.then(l(s,u,fn(F,r,"set",e,f),cn))):i&&r.set(e,f)}return 0==c.length?r:e(c).then(f(r))}(t,o):"function"==typeof t.filter?t.filter(o):"function"==typeof t[P]?nn(t[P](),o):"function"==typeof t[$]?tn(t[$](),o):t.constructor==Object?function(t,o){const r={},c=[];for(const e in t){const f=t[e],i=o(f,e,t);n(i)?c.push(i.then(g(sn,r,e,t[e],u))):i&&(r[e]=f)}return 0==c.length?r:e(c).then(f(r))}(t,o):t},hn=Object.values,an=(Object.prototype.toString,async function(t,e,o){let r=t.next();if(r.done)return o;for(;!r.done;)o=e(o,r.value),n(o)&&(o=await o),r=t.next();return o}),pn=async function(t,e,o,r){const u=t.length;for(;++r<u;)o=e(o,t[r],r,t),n(o)&&(o=await o);return o},yn=Object.keys,dn=async function(t,e,o,r,u){const c=r.length;for(;++u<c;){const c=r[u];o=e(o,t[c],c,t),n(o)&&(o=await o)}return o},gn=async function(t,e,o,r){for(const[u,c]of r)o=e(o,c,u,t),n(o)&&(o=await o);return o},wn=function(t,e,o){return y(t)?function(t,e,o){const r=t.length;let c=-1;for(void 0===o&&(o=t[++c]);++c<r;)if(o=e(o,t[c],c,t),n(o))return o.then(g(pn,t,e,u,c));return o}(t,e,o):null==t?void 0===o?c(e,t,u):e(o,t):t.constructor==Map?function(t,e,o){const r=t.entries();if(void 0===o){const n=r.next();if(n.done)return o;o=n.value[1]}for(const[c,f]of r)if(o=e(o,f,c,t),n(o))return o.then(g(gn,t,e,u,r));return o}(t,e,o):"function"==typeof t[P]?function(t,e,o){let r=t.next();if(r.done)return o;for(void 0===o&&(o=r.value,r=t.next());!r.done;){if(o=e(o,r.value),n(o))return o.then(l(an,t,e,u));r=t.next()}return o}(t[P](),e,o):"function"==typeof t[$]?async function(n,t,e){let o=await n.next();if(o.done)return e;for(void 0===e&&(e=o.value,o=await n.next());!o.done;)e=await t(e,o.value),o=await n.next();return e}(t[$](),e,o):"function"==typeof t.reduce?t.reduce(e,o):"function"==typeof t.chain?t.chain(c(e,o,u)):"function"==typeof t.flatMap?t.flatMap(c(e,o,u)):t.constructor==Object?function(t,e,o){const r=yn(t),c=r.length;let f=-1;for(void 0===o&&(o=t[r[++f]]);++f<c;){const c=r[f];if(o=e(o,t[c],c,t),n(o))return o.then((i=dn,l=e,h=u,a=r,p=f,(s=t)==u?((n,t,e,o,r)=>function(u){return n(u,t,e,o,r)})(i,l,h,a,p):l==u?((n,t,e,o,r)=>function(u){return n(t,u,e,o,r)})(i,s,h,a,p):h==u?((n,t,e,o,r)=>function(u){return n(t,e,u,o,r)})(i,s,l,a,p):a==u?((n,t,e,o,r)=>function(u){return n(t,e,o,u,r)})(i,s,l,h,p):((n,t,e,o,r)=>function(u){return n(t,e,o,r,u)})(i,s,l,h,a)))}var i,s,l,h,a,p;return o}(t,e,o):void 0===o?c(e,t,u):e(o,t)},vn=function(t,e,o){if("function"==typeof o){const r=o(t);return n(r)?r.then(l(wn,t,e,u)):wn(t,e,r)}return n(o)?o.then(l(wn,t,e,u)):wn(t,e,o)},bn=ArrayBuffer.isView,jn=function(n,t){return y(t)||bn(t)?function(n,t){const e=n.length,o=t.length;let r=-1;for(;++r<o;)n[e+r]=t[r];return n}(n,t):(n.push(t),n)},xn="function"==typeof Buffer,Sn=xn?Buffer.alloc:cn,Mn=function(n,t){const e=n.length,o=xn&&n.constructor==Buffer?Sn(e+t.length):new n.constructor(e+t.length);return o.set(n),o.set(t,e),o},mn=function(n,t){return y(t)||bn(t)?Mn(n,t):Mn(n,[t])},On=(n,t)=>new Promise(((n,t)=>function(e,o){t.on("data",(n=>function(t,e,o){return n.write(t,e,o),n})(n)),t.on("end",un(e,n)),t.on("error",o)})(n,t)),An=function(n,t){return null!=(e=t)&&"function"==typeof e.pipe?On(n,t):(n.write(t),n);var e},zn=function(n,t){if(null!=t&&t.constructor==Set){for(const e of t)n.add(e);return n}return n.add(t)},En=function(n,t){return n.concat(t)},In=function(t,e,o){const r=wn(t,e(cn),null);return n(r)?r.then(f(o)):o},Dn=function(t,e,o){if(y(o))return wn(t,e(jn),o);if(bn(o)){const r=wn(t,e(jn),[]);return n(r)?r.then(c(mn,o,u)):mn(o,r)}if(null==o)return In(t,e,o);const r=o.constructor;if("string"==typeof o||r==String){const r=wn(t,e(jn),[o]);return n(r)?r.then(l(_,u,"join","")):r.join("")}return"function"==typeof o.concat?wn(t,e(En),o):"function"==typeof o.write?wn(t,e(An),o):r==Set?wn(t,e(zn),o):r==Object?wn(t,e(S),o):In(t,e,o)},Pn=function(t,e,o){if("function"==typeof o){const r=o(t);return n(r)?r.then(l(Dn,t,e,u)):Dn(t,e,r)}return n(o)?o.then(l(Dn,t,e,u)):Dn(t,e,o)},Tn=function(n,t){return n.push(t),n},Bn=n=>new Promise((t=>{setTimeout(t,n)})),$n=(n,t)=>t,kn=n=>n,Cn=(n,t)=>function(...e){return t(n(...e))},_n=async function(t,o){const r=[];for await(const e of t){const t=o(e);n(t)&&r.push(t)}return 0==r.length?t:e(r).then(f(t))},qn=function(t){const o=t.length,r=[],i=[];let s=-1;for(;++s<o;){const e=t[s];if(y(e)){const n=e.length;let t=-1;for(;++t<n;)i.push(e[t])}else if(null==e)i.push(e);else if("function"==typeof e.then)r.push(e.then(c(Tn,i,u)));else if("function"==typeof e[P])for(const n of e)i.push(n);else if("function"==typeof e[$])r.push(_n(e[$](),c(Tn,i,u)));else if("function"==typeof e.chain){const t=e.chain(kn);n(t)?r.push(t.then(c(Tn,i,u))):i.push(t)}else if("function"==typeof e.flatMap){const t=e.flatMap(kn);n(t)?r.push(t.then(c(Tn,i,u))):i.push(t)}else if("function"==typeof e.reduce){const t=e.reduce(Cn($n,c(Tn,i,u)),null);n(t)&&r.push(t)}else if(e.constructor==Object)for(const n in e)i.push(e[n]);else i.push(e)}return 0==r.length?i:e(r).then(f(i))},Fn=function(t){const o=[],r={},f=c(S,r,u),i=Cn($n,f);for(const e in t){const u=t[e];if(null!=u)if("function"==typeof u[P])for(const n of u)S(r,n);else if("function"==typeof u[$])o.push(_n(u[$](),f));else if("function"==typeof u.chain){const t=u.chain(kn);n(t)?o.push(t.then(f)):S(r,t)}else if("function"==typeof u.flatMap){const t=u.flatMap(kn);n(t)?o.push(t.then(f)):f(t)}else if("function"==typeof u.reduce){const t=u.reduce(i,null);n(t)&&o.push(t)}else S(r,u)}return 0==o.length?r:e(o).then((()=>r))},Rn=function(t){t.size;const o=[],r=new Set,c=(n,t)=>r.add(t),f=l(_,r,"add",u);for(const e of t)if(y(e)){const n=e.length;let t=-1;for(;++t<n;)r.add(e[t])}else if(null==e)r.add(e);else if("function"==typeof e[P])for(const n of e)r.add(n);else if("function"==typeof e[$])o.push(_n(e[$](),f));else if("function"==typeof e.chain){const t=e.chain(kn);n(t)?o.push(t.then(f)):r.add(t)}else if("function"==typeof e.flatMap){const t=e.flatMap(kn);n(t)?o.push(t.then(f)):r.add(t)}else if("function"==typeof e.reduce){const t=e.reduce(c,null);n(t)&&o.push(t)}else if(e.constructor==Object)for(const n in e)r.add(e[n]);else r.add(e);return 0==o.length?r:e(o).then((()=>r))},Vn=o(qn,c(((n,t)=>n.join(t)),u,"")),Gn=function(t,e){if(y(t))return function(t,e){const o=C(t,e);return n(o)?o.then(qn):qn(o)}(t,e);if(null==t)return e(t);if("function"==typeof t.then)return t.then(e);if("function"==typeof t.next)return P in t?function(n,t){let e=[],o=0;return{[P](){return this},next(){if(o<e.length){const n=e[o];return o+=1,{value:n,done:!1}}const r=n.next();if(r.done)return r;const u=wn(t(r.value),Tn,[]);return u.length>1&&(e=u,o=1),{value:u[0],done:!1}}}}(t,e):function(t,e){const o=[],r=new Set;return{isAsyncIteratorDone:!1,[$](){return this},toString:()=>"[object FlatMappingAsyncIterator]",async next(){for(;!this.isAsyncIteratorDone||o.length>0||r.size>0;){if(!this.isAsyncIteratorDone){const{value:c,done:f}=await t.next();if(f)this.isAsyncIteratorDone=f;else{const t=e(c);if(n(t)){const n=t.then(l(wn,u,Tn,o)).then((()=>r.delete(n)));r.add(n)}else{const e=wn(t,Tn,o);if(n(e)){const n=e.then((()=>r.delete(n)));r.add(n)}}}}if(o.length>0)return{value:o.shift(),done:!1};r.size>0&&await J([Bn(1e3),...r])}return{value:void 0,done:!0}}}}(t,e);if("function"==typeof t.chain)return t.chain(e);if("function"==typeof t.flatMap)return t.flatMap(e);const o=t.constructor;return o==Object?function(t,e){const o=V(t,e);return n(o)?o.then(Fn):Fn(o)}(t,e):o==Set?function(t,e){const o=q(t,e);return n(o)?o.then(Rn):Rn(o)}(t,e):"string"==typeof t||o==String?function(t,e){const o=C(t,e);return n(o)?o.then(Vn):Vn(o)}(t,e):e(t)},Hn=async function(t,e,o){const r=t.length;for(;++o<r;){const r=e(t[o]);n(r)&&await r}return t},Jn=async function(t,e,o){for(const r in t){if(r==o)continue;const u=e(t[r]);n(u)&&await u}return t},Kn=async function(t,e){let o=t.next();for(;!o.done;){const r=e(o.value);n(r)&&await r,o=t.next()}return t},Ln=function(t,o){return y(t)?function(t,o){const r=t.length,u=[];let c=-1;for(;++c<r;){const e=o(t[c]);n(e)&&u.push(e)}return 0==u.length?t:e(u).then(f(t))}(t,o):null==t?t:"function"==typeof t.forEach?t.forEach(o):"function"==typeof t[P]?function(t,o){const r=[];for(const e of t){const t=o(e);n(t)&&r.push(t)}return 0==r.length?t:e(r).then(f(t))}(t[P](),o):"function"==typeof t[$]?_n(t[$](),o):t.constructor==Object?function(t,o){const r=[];for(const e in t){const u=o(t[e]);n(u)&&r.push(u)}return 0==r.length?t:e(r).then(f(t))}(t,o):t},Nn=function(t,e){return"function"==typeof t?c(Ln,u,t):n(t)?t.then(c(Ln,u,e)):Ln(t,e)},Qn=function(t,e){if(y(t))return function(t,e){const o=t.length;let r=-1;for(;++r<o;){const o=e(t[r]);if(n(o))return o.then(A(Hn,t,e,r))}return t}(t,e);if(null==t)throw new Error(`invalid collection ${t}`);if("function"==typeof t[P])return function(t,e){let o=t.next();for(;!t.done;){const r=e(o.value);if(n(r))return r.then(I(Kn,t,e));o=t.next()}return t}(t[P](),e);if("function"==typeof t[$])return async function(t,e){for await(const o of t){const t=e(o);n(t)&&await t}return t}(t[$](),e);if(t.constructor==Object)return function(t,e){for(const o in t){const r=e(t[o]);if(n(r))return r.then(A(Jn,t,e,o))}return t}(t,e);throw new Error(`invalid collection ${t}`)};Nn.series=function(t,e){return"function"==typeof t?c(Qn,u,t):n(t)?t.then(c(Qn,u,e)):Qn(t,e)};const Un=function(n){const t=n.then((n=>[n,t]));return t},Wn=async function(t,e,o,r){const u=t.length;for(;++o<u;){const u=e(t[o]);if(n(u))r.add(Un(u));else if(u)return!0}for(;r.size>0;){const[n,t]=await J(r);if(r.delete(t),n)return!0}return!1},Xn=function(t,e){const o=t.length;let r=-1;for(;++r<o;){const o=e(t[r]);if(n(o))return Wn(t,e,r,new Set([Un(o)]));if(o)return!0}return!1},Yn=async function(t,e,o,r=20){let u=t.next();for(n(u)&&(u=await u);!u.done;){if(o.size>=r){const[n,t]=await J(o);if(o.delete(t),n)return!0}const c=e(u.value);if(n(c))o.add(Un(c));else if(c)return!0;u=t.next(),n(u)&&(u=await u)}for(;o.size>0;){const[n,t]=await J(o);if(o.delete(t),n)return!0}return!1},Zn=function(t,e){return y(t)?Xn(t,e):null==t?e(t):"function"==typeof t[P]?function(t,e){for(const o of t){const r=e(o);if(n(r))return Yn(t,e,new Set([Un(r)]));if(r)return!0}return!1}(t[P](),e):"function"==typeof t[$]?Yn(t[$](),e,new Set):"function"==typeof t.reduce?t.reduce((t=>function(e,o){return!0===e?e:n(e)?e.then(c((n=>function(t,e){return!!t||n(e)})(t),u,o)):!!e||t(o)})(e),!1):t.constructor==Object?Xn(hn(t),e):e(t)},nt=function(t,o){const r=t.length,c=[];let f=-1;for(;++f<r;){const e=o(t[f]);if(n(e))c.push(e);else if(!e)return!1}return 0==c.length||e(c).then(l(_,u,"every",Boolean))},tt=(n,t,e)=>!!t&&n(e),et=function(t,o){return y(t)?nt(t,o):null==t?o(t):"function"==typeof t[P]?function(t,o){const r=[];for(const e of t){const t=o(e);if(n(t))r.push(t);else if(!t)return!1}return 0==r.length||e(r).then(l(_,u,"every",Boolean))}(t[P](),o):"function"==typeof t[$]?async function(t,e,o,r=20){let u=await t.next();for(;!u.done;){if(o.size>=r){const[n,t]=await J(o);if(o.delete(t),!n)return!1}const c=e(u.value);if(n(c))o.add(Un(c));else if(!c)return!1;u=await t.next()}for(;o.size>0;){const[n,t]=await J(o);if(o.delete(t),!n)return!1}return!0}(t[$](),o,new Set):"function"==typeof t.reduce?t.reduce((t=>function(e,o){return!1!==e&&(n(e)?e.then(l(tt,t,u,o)):!!e&&t(o))})(o),!0):t.constructor==Object?nt(hn(t),o):o(t)},ot=function(t,e){const o=t.length;for(;++e<o;){const o=t[e];if(n(o))return o.then(l(s,u,I(ot,t,e),f(!1)));if(!o)return!1}return!0},rt=async function(t,e,o){const r=e.length;for(;++o<r;){let r=e[o];if("function"==typeof r&&(r=r(...t)),n(r)&&(r=await r),!r)return!1}return!0},ut=function(t,e){const o=e.length;let r=-1;for(;++r<o;){let o=e[r];if("function"==typeof o&&(o=o(...t)),n(o))return o.then(l(s,u,A(rt,t,e,r),f(!1)));if(!o)return!1}return!0},ct=function(t,e){const o=t.length;for(;++e<o;){const o=t[e];if(n(o))return o.then(l(s,u,f(!0),I(ct,t,e)));if(o)return!0}return!1},ft=async function(t,e,o){const r=e.length;for(;++o<r;){let r=e[o];if("function"==typeof r&&(r=r(...t)),n(r)&&(r=await r),r)return!0}return!1},it=function(t,e){const o=e.length;let r=-1;for(;++r<o;){let o=e[r];if("function"==typeof o&&(o=o(...t)),n(o))return o.then(l(s,u,f(!0),A(ft,t,e,r)));if(o)return!0}return!1},st=n=>!n,lt=function(t,e){const o=e(...t);return n(o)?o.then(st):!o},ht=function(n,t,e,o,r){return t==u?((n,t,e,o)=>function(...r){return n(r,t,e,o)})(n,e,o,r):e==u?((n,t,e,o)=>function(...r){return n(t,r,e,o)})(n,t,o,r):o==u?((n,t,e,o)=>function(...r){return n(t,e,r,o)})(n,t,e,r):((n,t,e,o)=>function(...r){return n(t,e,o,r)})(n,t,e,o)},at=function(t,o,r,u){const c=r(...t),f=u(...t);return n(c)||n(f)?e([c,f]).then(Q(o)):o(c,f)},pt=function(t,o,r,u){const c=r(...t);return n(c)||n(u)?e([c,u]).then(Q(o)):o(c,u)},yt=function(t,o,r,u){const c=u(...t);return n(r)||n(c)?e([r,c]).then(Q(o)):o(r,c)},dt=o=>function(...r){const c=r.pop(),f=r.pop(),i="function"==typeof f,s="function"==typeof c;return i&&s?0==r.length?ht(at,u,o,f,c):t(r)?e(r).then(g(at,u,o,f,c)):at(r,o,f,c):i?0==r.length?ht(pt,u,o,f,c):t(r)?e(r).then(g(pt,u,o,f,c)):pt(r,o,f,c):s?0==r.length?ht(yt,u,o,f,c):t(r)?e(r).then(g(yt,u,o,f,c)):yt(r,o,f,c):n(f)||n(c)?e([f,c]).then(Q(o)):o(f,c)},gt=dt((function(n,t){return n==t})),wt=dt(((n,t)=>n>t)),vt=dt(((n,t)=>n<t)),bt=dt(((n,t)=>n>=t)),jt=dt(((n,t)=>n<=t)),xt=/[.|[|\]]+/,St=function(n,t){const e=new Map,o=function(o){if(e.has(o))return e.get(o);const r=n(o);return e.set(o,r),e.size>t&&e.clear(),r};return o.cache=e,o}((function(n){const t=n.length-1,e="["==n[0],o="]"==n[t];return e&&o?n.slice(1,t).split(xt):e?n.slice(1).split(xt):o?n.slice(0,t).split(xt):n.split(xt)}),500),Mt=n=>y(n)?n:"string"==typeof n?St(n):[n],mt=function(n,t){const e=Mt(t),o=e.length;let r=-1,u=n;for(;++r<o;)if(u=u[e[r]],null==u)return;return u},Ot=function(n,t,e){const o=null==n?void 0:mt(n,t);return void 0===o?"function"==typeof e?e(n):e:o},At=function(n,t,e){if(!(n=>{if(null==n)return!1;const t=typeof n;return"object"==t||"function"==t})(n))return n;const o=Mt(e),r=o.length,u=r-1,c={...n};let f=c,i=-1;for(;++i<r;){const n=o[i];if(i==u)f[n]=t;else{const t=f[n],e=y(t)?t.slice():{...t};f[n]=e,f=e}}return c},zt=function(t,e,o){if("function"==typeof o){const r=o(t);return n(r)?r.then(l(At,t,u,e)):At(t,r,e)}return n(o)?o.then(l(At,t,u,e)):At(t,o,e)},Et=function(n,t){if(null==n)return n;const e=t.length;let o={},r=-1;for(;++r<e;){const e=t[r],u=mt(n,e);null!=u&&(o=At(o,u,e))}return o},It=function(n,t){if(null==n)return;const e=Mt(t),o=e.length-1;let r=-1,u=n;for(;++r<o;)if(u=u[e[r]],null==u)return;const c=e[r];null!=u&&c in u&&delete u[c]},Dt=function(n){const t={};for(const e in n){const o=n[e];y(o)?t[e]=Pt(o):null!=o&&o.constructor==Object?t[e]=Dt(o):t[e]=o}return t},Pt=function(n){const t=n.length,e=[];let o=-1;for(;++o<t;){const t=n[o];y(t)?e[o]=Pt(t):null!=t&&t.constructor==Object?e[o]=Dt(t):e[o]=t}return e},Tt=function(n,t){const e=t.length,o=y(r=n)?Pt(r):null==r?r:r.constructor==Object?Dt(r):r;var r;let u=-1;for(;++u<e;)It(o,t[u]);return o},Bt=(n,...t)=>N(n.length,n,t);Bt.arity=function(n,t,...e){return N(n,t,e)};return{pipe:function(...n){const f=n.pop().reduce(o);return 0==n.length?f:t(n)?e(n).then(c(r,f,u)):f(...n)},compose:function(...n){const f=n.pop().reduceRight(o);return 0==n.length?f:t(n)?e(n).then(c(r,f,u)):f(...n)},tap:p,forEach:Nn,switchCase:(...n)=>{const o=n.pop();return E(o)?D(o,-2):0==n.length?(r=z,f=u,i=-2,(c=o)==u?((n,t,e)=>function(...o){return n(o,t,e)})(r,f,i):f==u?((n,t,e)=>function(...o){return n(t,o,e)})(r,c,i):((n,t,e)=>function(...o){return n(t,e,o)})(r,c,f)):t(n)?e(n).then(l(z,o,u,-2)):z(o,n,-2);var r,c,f,i},tryCatch:function(...n){if(n.length>2){const o=n.pop(),r=n.pop();return t(n)?e(n).then(l(O,r,o,u)):O(r,o,n)}const o=n[0],r=n[1];return function(...n){return O(o,r,n)}},all:x,assign:function(t,e){return null==e?c(M,u,t):n(t)?t.then(c(M,u,e)):M(t,e)},get:function(t,e,o){return"string"==typeof t||"number"==typeof t||y(t)?l(Ot,u,t,e):n(t)?t.then(l(Ot,u,e,o)):Ot(t,e,o)},set:function(t,e,o){return null==o?l(zt,u,t,e):n(t)?t.then(l(zt,u,e,o)):zt(t,e,o)},pick:function(t,e){return null==e?c(Et,u,t):n(t)?t.then(c(Et,u,e)):Et(t,e)},omit:function(t,e){return null==e?c(Tt,u,t):n(t)?t.then(c(Tt,u,e)):Tt(t,e)},map:Y,filter:function(...n){const t=n.pop();return 0==n.length?c(ln,u,t):ln(n[0],t)},flatMap:(...t)=>{const e=t.pop();if(0==t.length)return c(Gn,u,e);const o=t[0];return n(o)?o.then(c(Gn,u,e)):Gn(t[0],e)},reduce:function(...t){return"function"==typeof t[0]?l(vn,u,t[0],t[1]):n(t[0])?t[0].then(l(vn,u,t[1],t[2])):vn(t[0],t[1],t[2])},transform:function(...t){return"function"==typeof t[0]?l(Pn,u,t[0],t[1]):n(t[0])?t[0].then(l(Pn,u,t[1],t[2])):Pn(t[0],t[1],t[2])},and:function(...n){const o=n.pop();return E(o)?ot(o,-1):0==n.length?h(ut,u,o):t(n)?e(n).then(c(ut,u,o)):ut(n,o)},or:function(...n){const o=n.pop();return E(o)?ct(o,-1):0==n.length?h(it,u,o):t(n)?e(n).then(c(it,u,o)):it(n,o)},not:function(...n){const o=n.pop();return"function"==typeof o?0==n.length?h(lt,u,o):t(n)?e(n).then(c(lt,u,o)):lt(n,o):!o},some:function(...t){const e=t.pop();if(0==t.length)return c(Zn,u,e);const o=t[0];return n(o)?o.then(c(Zn,u,e)):Zn(o,e)},every:function(...t){const e=t.pop();if(0==t.length)return c(et,u,e);const o=t[0];return n(o)?o.then(c(et,u,e)):et(o,e)},eq:gt,gt:wt,lt:vt,gte:bt,lte:jt,thunkify:(n,...o)=>function(){return t(o)?e(o).then(c(r,n,u)):n(...o)},always:f,curry:Bt,__:u}}());
|
|
8
|
+
!function(n,t){"object"==typeof module?module.exports=t:"function"==typeof define?define((()=>t)):n.rubico=t}("object"==typeof globalThis?globalThis:this,function(){"use strict";const n=n=>null!=n&&"function"==typeof n.then,t=function(t){const e=t.length;let o=-1;for(;++o<e;){const e=t[o];if(n(e))return!0}return!1},e=Promise.all.bind(Promise),o=(t,e)=>function(...o){const r=t(...o);return n(r)?r.then(e):e(r)},r=(n,t)=>n(...t),u=Symbol.for("placeholder"),c=function(n,t,e){return t==u?((n,t)=>function(e){return n(e,t)})(n,e):((n,t)=>function(e){return n(t,e)})(n,t)},f=n=>function(){return n},i=(n,t)=>function(){return n(...t)},s=(n,t,e)=>n?t():e(),l=function(n,t,e,o){return t==u?((n,t,e)=>function(o){return n(o,t,e)})(n,e,o):e==u?((n,t,e)=>function(o){return n(t,o,e)})(n,t,o):((n,t,e)=>function(o){return n(t,e,o)})(n,t,e)},h=function(n,t,e){return t==u?((n,t)=>function(...e){return n(e,t)})(n,e):((n,t)=>function(...e){return n(t,e)})(n,t)},a=function(t,e){const o=t[0],r=e(...t);return n(r)?r.then(f(o)):o},p=function(...n){const t=n.pop();return 0==n.length?h(a,u,t):a(n,t)};p.if=(t,e)=>function(...o){const r=t(...o);if(n(r))return r.then(l(s,u,i(p(e),o),f(o[0])));if(r){const t=e(...o);if(n(t))return t.then(f(o[0]))}return o[0]};const y=Array.isArray,d=function(t,o){const r=t.length,u=Array(r);let c=-1,f=!1;for(;++c<r;){const e=t[c](...o);n(e)&&(f=!0),u[c]=e}return f?e(u):u},g=function(n,t,e,o,r){return t==u?((n,t,e,o)=>function(r){return n(r,t,e,o)})(n,e,o,r):e==u?((n,t,e,o)=>function(r){return n(t,r,e,o)})(n,t,o,r):o==u?((n,t,e,o)=>function(r){return n(t,e,r,o)})(n,t,e,r):((n,t,e,o)=>function(r){return n(t,e,o,r)})(n,t,e,o)},w=function(n,t,e){return n[t]=e,n},v=async function(t,e,o,r){const u=t.length;for(;++r<u;){const u=t[r](...e);o[r]=n(u)?await u:u}return o},b=function(t,e){const r=t.length,c=[];let f=-1;for(;++f<r;){const r=t[f](...e);if(n(r))return r.then(o(l(w,c,f,u),g(v,t,e,u,f)));c[f]=r}return c},j=function(t,o){const r={},c=[];for(const e in t){const f=t[e](...o);n(f)?c.push(f.then(l(w,r,e,u))):r[e]=f}return 0==c.length?r:e(c).then(f(r))},x=function(...n){const o=n.pop();return 0==n.length?y(o)?h(d,o,u):h(j,o,u):t(n)?y(o)?e(n).then(c(d,o,u)):e(n).then(c(j,o,u)):y(o)?d(o,n):j(o,n)};x.series=function(...n){const o=n.pop();return 0==n.length?h(b,o,u):t(n)?e(n).then(c(b,o,u)):b(o,n)};const S=Object.assign,M=function(t,e){const o=j(e,[t]);return n(o)?o.then(l(S,{},t,u)):{...t,...o}},m=function(n,t,e){return n(t,...e)},O=function(t,e,o){try{const r=t(...o);return n(r)?r.catch(l(m,e,u,o)):r}catch(n){return e(n,...o)}},A=(n,t,e,o)=>function(){return n(t,e,o)},z=function(t,e,o){const r=t.length-1;for(;(o+=2)<r;){const r=t[o],c=t[o+1],h="function"==typeof r?r(...e):r;if(n(h))return h.then(l(s,u,"function"==typeof c?i(c,e):f(c),A(z,t,e,o)));if(h)return"function"==typeof c?c(...e):c}if(o==t.length)return;const c=t[r];return"function"==typeof c?c(...e):c},E=function(n){const t=n.length;let e=-1;for(;++e<t;)if("function"==typeof n[e])return!1;return!0},I=(n,t,e)=>function(){return n(t,e)},D=function(t,e){const o=t.length,r=o-1;for(;(e+=2)<r;){const o=t[e],r=t[e+1];if(n(o))return o.then(l(s,u,f(r),I(D,t,e)));if(o)return r}if(e!=o)return t[e]},P=Symbol.iterator,T=(n,t)=>({toString:()=>"[object MappingIterator]",[P](){return this},next(){const e=n.next();return e.done?e:{value:t(e.value),done:!1}}}),B=n=>({value:n,done:!1}),$=Symbol.asyncIterator,k=(t,e)=>({[$](){return this},async next(){const o=await t.next();if(o.done)return o;const r=e(o.value);return n(r)?r.then(B):{value:r,done:!1}}}),C=function(t,o){const r=t.length,u=Array(r);let c=-1,f=!1;for(;++c<r;){const e=o(t[c],c,t);n(e)&&(f=!0),u[c]=e}return f?e(u):u},_=(n,t,e)=>n[t](e),q=function(t,o){const r=new Set,c=[];for(const e of t){const f=o(e,e,t);n(f)?c.push(f.then(l(_,r,"add",u))):r.add(f)}return 0==c.length?r:e(c).then(f(r))},F=(n,t,e,o)=>n[t](e,o),R=t=>new Promise((t=>function(e){const o={};let r=0;for(const u in t){const c=t[u];n(c)?(r+=1,c.then((n=>function(t){o[n]=t,r-=1,0==r&&e(o)})(u))):o[u]=c}0==r&&e(o)})(t)),V=function(t,e){const o={};let r=!1;for(const u in t){const c=e(t[u],u,t);n(c)&&(r=!0),o[u]=c}return r?R(o):o},G=async function(t,e,o,r){const u=t.length;for(;++r<u;){const u=e(t[r],r);o[r]=n(u)?await u:u}return o},H=n=>function(...t){return n(...t),t[0]},J=Promise.race.bind(Promise),K=async function(t,o,r,u,c,f){const i=t.length;for(;++c<i;){f.size>=r&&await J(f);const e=o(t[c]);if(n(e)){const n=e.then(H((()=>f.delete(n))));f.add(n),u[c]=n}else u[c]=e}return e(u)},L=(n,t,e)=>function(...o){const r=e.length,c=o.length,f=[];let i=-1,s=-1,l=0;for(;++i<r;){const r=e[i];if(r==u&&(s+=1)<c){const n=o[s];n==u&&(l+=1),f.push(n)}else f.push(r);if(f.length==n)return 0==l?t(...f):N(n,t,f)}for(;++s<c;){const e=o[s];if(e==u&&(l+=1),f.push(e),f.length==n)return 0==l?t(...f):N(n,t,f)}return N(n,t,f)},N=function(n,t,e){const o=e.length;if(o<n)return L(n,t,e);let r=-1;for(;++r<o;){if(e[r]==u)return L(n,t,e)}return t(...e)},Q=n=>function([t,e]){return n(t,e)},U=function(n,t,e){return n.set(t,e)},W=function(t,o){const r=new Map,u=[];return t.forEach(((t,e,o)=>function(r,u){const c=t([u,r]);n(c)?o.push(c.then(Q(N(3,U,[e])))):e.set(c[0],c[1])})(o,r,u)),0==u.length?r:e(u).then(f(r))},X=function(t,o){return y(t)?C(t,o):null==t?t:"function"==typeof t.then?t.then(o):"function"==typeof t.map?t.map(o):"string"==typeof t||t.constructor==String?function(t,e){const o=C(t,e);return n(o)?o.then(l(_,u,"join","")):o.join("")}(t,o):t.constructor==Set?q(t,o):t.constructor==Map?function(t,o){const r=new Map,c=[];for(const[e,f]of t){const i=o(f,e,t);n(i)?c.push(i.then(g(F,r,"set",e,u))):r.set(e,i)}return 0==c.length?r:e(c).then(f(r))}(t,o):"function"==typeof t[P]?T(t[P](),o):"function"==typeof t[$]?k(t[$](),o):t.constructor==Object?V(t,o):o(t)},Y=function(t,e){return"function"==typeof t?c(X,u,t):n(t)?t.then(c(X,u,e)):X(t,e)},Z=(t,o)=>{if(null==t)throw new TypeError("value is not an Object or Map");if(t.constructor==Object)return function(t,o){const r={},u=[];for(const e in t){const c=o([e,t[e]]);n(c)?u.push(c.then(Q(N(3,w,[r])))):r[c[0]]=c[1]}return 0==u.length?r:e(u).then(f(r))}(t,o);if(t.constructor==Map)return W(t,o);throw new TypeError("value is not an Object or Map")};Y.entries=function(t,e){return"function"==typeof t?c(Z,u,t):n(t)?t.then(c(Z,u,e)):Z(t,e)},Y.series=t=>function(e){if(y(e))return function(t,e){const r=t.length,c=Array(r);let f=-1;for(;++f<r;){const r=e(t[f],f);if(n(r))return r.then(o(l(w,c,f,u),g(G,t,e,u,f)));c[f]=r}return c}(e,t);throw new TypeError(`${e} is not an Array`)},Y.pool=(t,e)=>function(o){if(y(o))return function(t,e,o){const r=t.length,u=Array(r);let c=-1;for(;++c<r;){const r=e(t[c]);if(n(r)){const n=new Set,f=r.then(H((()=>n.delete(f))));return n.add(f),u[c]=f,K(t,e,o,u,c,n)}u[c]=r}return u}(o,e,t);throw new TypeError(`${o} is not an Array`)};const nn=(n,t)=>({[P](){return this},next(){let e=n.next();for(;!e.done;){const{value:o}=e;if(t(o))return{value:o,done:!1};e=n.next()}return e}}),tn=(t,e)=>({isAsyncIteratorDone:!1,[$](){return this},async next(){for(;!this.isAsyncIteratorDone;){const{value:o,done:r}=await t.next();if(r)this.isAsyncIteratorDone=!0;else{const t=e(o);if(n(t)?await t:t)return{value:o,done:!1}}}return{value:void 0,done:!0}}}),en=function(n,t,e,o){const r=t.length;let u=n.length-1;for(;++o<r;)n[++u]=e(t[o],o,n);return n},on=function(n,t,e,o){const r=n.length;let u=-1;for(;++e<r;)o[++u]&&t.push(n[e]);return t},rn=function(t,o){const r=t.length,c=[];let f=-1,i=-1;for(;++f<r;){const r=t[f],s=o(r,f,t);if(n(s))return e(en([s],t,o,f)).then(g(on,t,c,f-1,u));s&&(c[++i]=r)}return c},un=(n,t)=>function(){return n(t)},cn=function(){},fn=(n,t,e,o,r)=>function(){return n(t,e,o,r)},sn=function(n,t,e,o){o&&(n[t]=e)},ln=function(t,o){return y(t)?rn(t,o):null==t?t:"string"==typeof t||t.constructor==String?function(t,e){const o=rn(t,e);return n(o)?o.then(l(_,u,"join","")):o.join("")}(t,o):t.constructor==Set?function(t,o){const r=new Set,c=r.add.bind(r),i=[];for(const e of t){const f=o(e,e,t);n(f)?i.push(f.then(l(s,u,un(c,e),cn))):f&&r.add(e)}return 0==i.length?r:e(i).then(f(r))}(t,o):t.constructor==Map?function(t,o){const r=new Map,c=[];for(const[e,f]of t){const i=o(f,e,t);n(i)?c.push(i.then(l(s,u,fn(F,r,"set",e,f),cn))):i&&r.set(e,f)}return 0==c.length?r:e(c).then(f(r))}(t,o):"function"==typeof t.filter?t.filter(o):"function"==typeof t[P]?nn(t[P](),o):"function"==typeof t[$]?tn(t[$](),o):t.constructor==Object?function(t,o){const r={},c=[];for(const e in t){const f=t[e],i=o(f,e,t);n(i)?c.push(i.then(g(sn,r,e,t[e],u))):i&&(r[e]=f)}return 0==c.length?r:e(c).then(f(r))}(t,o):t},hn=Object.values,an=(Object.prototype.toString,async function(t,e,o){let r=t.next();if(r.done)return o;for(;!r.done;)o=e(o,r.value),n(o)&&(o=await o),r=t.next();return o}),pn=async function(t,e,o,r){const u=t.length;for(;++r<u;)o=e(o,t[r],r,t),n(o)&&(o=await o);return o},yn=Object.keys,dn=async function(t,e,o,r,u){const c=r.length;for(;++u<c;){const c=r[u];o=e(o,t[c],c,t),n(o)&&(o=await o)}return o},gn=async function(t,e,o,r){for(const[u,c]of r)o=e(o,c,u,t),n(o)&&(o=await o);return o},wn=function(t,e,o){return y(t)?function(t,e,o){const r=t.length;let c=-1;for(void 0===o&&(o=t[++c]);++c<r;)if(o=e(o,t[c],c,t),n(o))return o.then(g(pn,t,e,u,c));return o}(t,e,o):null==t?void 0===o?c(e,t,u):e(o,t):t.constructor==Map?function(t,e,o){const r=t.entries();if(void 0===o){const n=r.next();if(n.done)return o;o=n.value[1]}for(const[c,f]of r)if(o=e(o,f,c,t),n(o))return o.then(g(gn,t,e,u,r));return o}(t,e,o):"function"==typeof t[P]?function(t,e,o){let r=t.next();if(r.done)return o;for(void 0===o&&(o=r.value,r=t.next());!r.done;){if(o=e(o,r.value),n(o))return o.then(l(an,t,e,u));r=t.next()}return o}(t[P](),e,o):"function"==typeof t[$]?async function(n,t,e){let o=await n.next();if(o.done)return e;for(void 0===e&&(e=o.value,o=await n.next());!o.done;)e=await t(e,o.value),o=await n.next();return e}(t[$](),e,o):"function"==typeof t.reduce?t.reduce(e,o):"function"==typeof t.chain?t.chain(c(e,o,u)):"function"==typeof t.flatMap?t.flatMap(c(e,o,u)):t.constructor==Object?function(t,e,o){const r=yn(t),c=r.length;let f=-1;for(void 0===o&&(o=t[r[++f]]);++f<c;){const c=r[f];if(o=e(o,t[c],c,t),n(o))return o.then((i=dn,l=e,h=u,a=r,p=f,(s=t)==u?((n,t,e,o,r)=>function(u){return n(u,t,e,o,r)})(i,l,h,a,p):l==u?((n,t,e,o,r)=>function(u){return n(t,u,e,o,r)})(i,s,h,a,p):h==u?((n,t,e,o,r)=>function(u){return n(t,e,u,o,r)})(i,s,l,a,p):a==u?((n,t,e,o,r)=>function(u){return n(t,e,o,u,r)})(i,s,l,h,p):((n,t,e,o,r)=>function(u){return n(t,e,o,r,u)})(i,s,l,h,a)))}var i,s,l,h,a,p;return o}(t,e,o):void 0===o?c(e,t,u):e(o,t)},vn=function(t,e,o){if("function"==typeof o){const r=o(t);return n(r)?r.then(l(wn,t,e,u)):wn(t,e,r)}return n(o)?o.then(l(wn,t,e,u)):wn(t,e,o)},bn=ArrayBuffer.isView,jn=function(n,t){return y(t)||bn(t)?function(n,t){const e=n.length,o=t.length;let r=-1;for(;++r<o;)n[e+r]=t[r];return n}(n,t):(n.push(t),n)},xn="function"==typeof Buffer,Sn=xn?Buffer.alloc:cn,Mn=function(n,t){const e=n.length,o=xn&&n.constructor==Buffer?Sn(e+t.length):new n.constructor(e+t.length);return o.set(n),o.set(t,e),o},mn=function(n,t){return y(t)||bn(t)?Mn(n,t):Mn(n,[t])},On=(n,t)=>new Promise(((n,t)=>function(e,o){t.on("data",(n=>function(t,e,o){return n.write(t,e,o),n})(n)),t.on("end",un(e,n)),t.on("error",o)})(n,t)),An=function(n,t){return null!=(e=t)&&"function"==typeof e.pipe?On(n,t):(n.write(t),n);var e},zn=function(n,t){if(null!=t&&t.constructor==Set){for(const e of t)n.add(e);return n}return n.add(t)},En=function(n,t){return n.concat(t)},In=function(t,e,o){const r=wn(t,e(cn),null);return n(r)?r.then(f(o)):o},Dn=function(t,e,o){if(y(o))return wn(t,e(jn),o);if(bn(o)){const r=wn(t,e(jn),[]);return n(r)?r.then(c(mn,o,u)):mn(o,r)}if(null==o)return In(t,e,o);const r=o.constructor;if("string"==typeof o||r==String){const r=wn(t,e(jn),[o]);return n(r)?r.then(l(_,u,"join","")):r.join("")}return"function"==typeof o.concat?wn(t,e(En),o):"function"==typeof o.write?wn(t,e(An),o):r==Set?wn(t,e(zn),o):r==Object?wn(t,e(S),o):In(t,e,o)},Pn=function(t,e,o){if("function"==typeof o){const r=o(t);return n(r)?r.then(l(Dn,t,e,u)):Dn(t,e,r)}return n(o)?o.then(l(Dn,t,e,u)):Dn(t,e,o)},Tn=function(n,t){return n.push(t),n},Bn=n=>new Promise((t=>{setTimeout(t,n)})),$n=(n,t)=>t,kn=n=>n,Cn=(n,t)=>function(...e){return t(n(...e))},_n=async function(t,o){const r=[];for await(const e of t){const t=o(e);n(t)&&r.push(t)}return 0==r.length?t:e(r).then(f(t))},qn=function(t){const o=t.length,r=[],i=[];let s=-1;for(;++s<o;){const e=t[s];if(y(e)){const n=e.length;let t=-1;for(;++t<n;)i.push(e[t])}else if(null==e)i.push(e);else if("function"==typeof e.then)r.push(e.then(c(Tn,i,u)));else if("function"==typeof e[P])for(const n of e)i.push(n);else if("function"==typeof e[$])r.push(_n(e[$](),c(Tn,i,u)));else if("function"==typeof e.chain){const t=e.chain(kn);n(t)?r.push(t.then(c(Tn,i,u))):i.push(t)}else if("function"==typeof e.flatMap){const t=e.flatMap(kn);n(t)?r.push(t.then(c(Tn,i,u))):i.push(t)}else if("function"==typeof e.reduce){const t=e.reduce(Cn($n,c(Tn,i,u)),null);n(t)&&r.push(t)}else if(e.constructor==Object)for(const n in e)i.push(e[n]);else i.push(e)}return 0==r.length?i:e(r).then(f(i))},Fn=function(t){const o=[],r={},f=c(S,r,u),i=Cn($n,f);for(const e in t){const u=t[e];if(null!=u)if("function"==typeof u[P])for(const n of u)S(r,n);else if("function"==typeof u[$])o.push(_n(u[$](),f));else if("function"==typeof u.chain){const t=u.chain(kn);n(t)?o.push(t.then(f)):S(r,t)}else if("function"==typeof u.flatMap){const t=u.flatMap(kn);n(t)?o.push(t.then(f)):f(t)}else if("function"==typeof u.reduce){const t=u.reduce(i,null);n(t)&&o.push(t)}else S(r,u)}return 0==o.length?r:e(o).then((()=>r))},Rn=function(t){t.size;const o=[],r=new Set,c=(n,t)=>r.add(t),f=l(_,r,"add",u);for(const e of t)if(y(e)){const n=e.length;let t=-1;for(;++t<n;)r.add(e[t])}else if(null==e)r.add(e);else if("function"==typeof e[P])for(const n of e)r.add(n);else if("function"==typeof e[$])o.push(_n(e[$](),f));else if("function"==typeof e.chain){const t=e.chain(kn);n(t)?o.push(t.then(f)):r.add(t)}else if("function"==typeof e.flatMap){const t=e.flatMap(kn);n(t)?o.push(t.then(f)):r.add(t)}else if("function"==typeof e.reduce){const t=e.reduce(c,null);n(t)&&o.push(t)}else if(e.constructor==Object)for(const n in e)r.add(e[n]);else r.add(e);return 0==o.length?r:e(o).then((()=>r))},Vn=o(qn,c(((n,t)=>n.join(t)),u,"")),Gn=function(t,e){if(y(t))return function(t,e){const o=C(t,e);return n(o)?o.then(qn):qn(o)}(t,e);if(null==t)return e(t);if("function"==typeof t.then)return t.then(e);if("function"==typeof t.next)return P in t?function(n,t){let e=[],o=0;return{[P](){return this},next(){if(o<e.length){const n=e[o];return o+=1,{value:n,done:!1}}const r=n.next();if(r.done)return r;const u=wn(t(r.value),Tn,[]);return u.length>1&&(e=u,o=1),{value:u[0],done:!1}}}}(t,e):function(t,e){const o=[],r=new Set;return{isAsyncIteratorDone:!1,[$](){return this},toString:()=>"[object FlatMappingAsyncIterator]",async next(){for(;!this.isAsyncIteratorDone||o.length>0||r.size>0;){if(!this.isAsyncIteratorDone){const{value:c,done:f}=await t.next();if(f)this.isAsyncIteratorDone=f;else{const t=e(c);if(n(t)){const n=t.then(l(wn,u,Tn,o)).then((()=>r.delete(n)));r.add(n)}else{const e=wn(t,Tn,o);if(n(e)){const n=e.then((()=>r.delete(n)));r.add(n)}}}}if(o.length>0)return{value:o.shift(),done:!1};r.size>0&&await J([Bn(1e3),...r])}return{value:void 0,done:!0}}}}(t,e);if("function"==typeof t.chain)return t.chain(e);if("function"==typeof t.flatMap)return t.flatMap(e);const o=t.constructor;return o==Object?function(t,e){const o=V(t,e);return n(o)?o.then(Fn):Fn(o)}(t,e):o==Set?function(t,e){const o=q(t,e);return n(o)?o.then(Rn):Rn(o)}(t,e):"string"==typeof t||o==String?function(t,e){const o=C(t,e);return n(o)?o.then(Vn):Vn(o)}(t,e):e(t)},Hn=async function(t,e,o){const r=t.length;for(;++o<r;){const r=e(t[o]);n(r)&&await r}return t},Jn=async function(t,e,o){for(const r in t){if(r==o)continue;const u=e(t[r]);n(u)&&await u}return t},Kn=async function(t,e){let o=t.next();for(;!o.done;){const r=e(o.value);n(r)&&await r,o=t.next()}return t},Ln=function(t,o){return y(t)?function(t,o){const r=t.length,u=[];let c=-1;for(;++c<r;){const e=o(t[c]);n(e)&&u.push(e)}return 0==u.length?t:e(u).then(f(t))}(t,o):null==t?t:"function"==typeof t.forEach?t.forEach(o):"function"==typeof t[P]?function(t,o){const r=[];for(const e of t){const t=o(e);n(t)&&r.push(t)}return 0==r.length?t:e(r).then(f(t))}(t[P](),o):"function"==typeof t[$]?_n(t[$](),o):t.constructor==Object?function(t,o){const r=[];for(const e in t){const u=o(t[e]);n(u)&&r.push(u)}return 0==r.length?t:e(r).then(f(t))}(t,o):t},Nn=function(t,e){return"function"==typeof t?c(Ln,u,t):n(t)?t.then(c(Ln,u,e)):Ln(t,e)},Qn=function(t,e){if(y(t))return function(t,e){const o=t.length;let r=-1;for(;++r<o;){const o=e(t[r]);if(n(o))return o.then(A(Hn,t,e,r))}return t}(t,e);if(null==t)throw new Error(`invalid collection ${t}`);if("function"==typeof t[P])return function(t,e){let o=t.next();for(;!t.done;){const r=e(o.value);if(n(r))return r.then(I(Kn,t,e));o=t.next()}return t}(t[P](),e);if("function"==typeof t[$])return async function(t,e){for await(const o of t){const t=e(o);n(t)&&await t}return t}(t[$](),e);if(t.constructor==Object)return function(t,e){for(const o in t){const r=e(t[o]);if(n(r))return r.then(A(Jn,t,e,o))}return t}(t,e);throw new Error(`invalid collection ${t}`)};Nn.series=function(t,e){return"function"==typeof t?c(Qn,u,t):n(t)?t.then(c(Qn,u,e)):Qn(t,e)};const Un=function(n){const t=n.then((n=>[n,t]));return t},Wn=async function(t,e,o,r){const u=t.length;for(;++o<u;){const u=e(t[o]);if(n(u))r.add(Un(u));else if(u)return!0}for(;r.size>0;){const[n,t]=await J(r);if(r.delete(t),n)return!0}return!1},Xn=function(t,e){const o=t.length;let r=-1;for(;++r<o;){const o=e(t[r]);if(n(o))return Wn(t,e,r,new Set([Un(o)]));if(o)return!0}return!1},Yn=async function(t,e,o,r=20){let u=t.next();for(n(u)&&(u=await u);!u.done;){if(o.size>=r){const[n,t]=await J(o);if(o.delete(t),n)return!0}const c=e(u.value);if(n(c))o.add(Un(c));else if(c)return!0;u=t.next(),n(u)&&(u=await u)}for(;o.size>0;){const[n,t]=await J(o);if(o.delete(t),n)return!0}return!1},Zn=function(t,e){return y(t)?Xn(t,e):null==t?e(t):"function"==typeof t[P]?function(t,e){for(const o of t){const r=e(o);if(n(r))return Yn(t,e,new Set([Un(r)]));if(r)return!0}return!1}(t[P](),e):"function"==typeof t[$]?Yn(t[$](),e,new Set):"function"==typeof t.reduce?t.reduce((t=>function(e,o){return!0===e?e:n(e)?e.then(c((n=>function(t,e){return!!t||n(e)})(t),u,o)):!!e||t(o)})(e),!1):t.constructor==Object?Xn(hn(t),e):e(t)},nt=function(t,o){const r=t.length,c=[];let f=-1;for(;++f<r;){const e=o(t[f]);if(n(e))c.push(e);else if(!e)return!1}return 0==c.length||e(c).then(l(_,u,"every",Boolean))},tt=(n,t,e)=>!!t&&n(e),et=function(t,o){return y(t)?nt(t,o):null==t?o(t):"function"==typeof t[P]?function(t,o){const r=[];for(const e of t){const t=o(e);if(n(t))r.push(t);else if(!t)return!1}return 0==r.length||e(r).then(l(_,u,"every",Boolean))}(t[P](),o):"function"==typeof t[$]?async function(t,e,o,r=20){let u=await t.next();for(;!u.done;){if(o.size>=r){const[n,t]=await J(o);if(o.delete(t),!n)return!1}const c=e(u.value);if(n(c))o.add(Un(c));else if(!c)return!1;u=await t.next()}for(;o.size>0;){const[n,t]=await J(o);if(o.delete(t),!n)return!1}return!0}(t[$](),o,new Set):"function"==typeof t.reduce?t.reduce((t=>function(e,o){return!1!==e&&(n(e)?e.then(l(tt,t,u,o)):!!e&&t(o))})(o),!0):t.constructor==Object?nt(hn(t),o):o(t)},ot=function(t,e){const o=t.length;for(;++e<o;){const o=t[e];if(n(o))return o.then(l(s,u,I(ot,t,e),f(!1)));if(!o)return!1}return!0},rt=async function(t,e,o){const r=e.length;for(;++o<r;){let r=e[o];if("function"==typeof r&&(r=r(...t)),n(r)&&(r=await r),!r)return!1}return!0},ut=function(t,e){const o=e.length;let r=-1;for(;++r<o;){let o=e[r];if("function"==typeof o&&(o=o(...t)),n(o))return o.then(l(s,u,A(rt,t,e,r),f(!1)));if(!o)return!1}return!0},ct=function(t,e){const o=t.length;for(;++e<o;){const o=t[e];if(n(o))return o.then(l(s,u,f(!0),I(ct,t,e)));if(o)return!0}return!1},ft=async function(t,e,o){const r=e.length;for(;++o<r;){let r=e[o];if("function"==typeof r&&(r=r(...t)),n(r)&&(r=await r),r)return!0}return!1},it=function(t,e){const o=e.length;let r=-1;for(;++r<o;){let o=e[r];if("function"==typeof o&&(o=o(...t)),n(o))return o.then(l(s,u,f(!0),A(ft,t,e,r)));if(o)return!0}return!1},st=n=>!n,lt=function(t,e){const o=e(...t);return n(o)?o.then(st):!o},ht=function(n,t,e,o,r){return t==u?((n,t,e,o)=>function(...r){return n(r,t,e,o)})(n,e,o,r):e==u?((n,t,e,o)=>function(...r){return n(t,r,e,o)})(n,t,o,r):o==u?((n,t,e,o)=>function(...r){return n(t,e,r,o)})(n,t,e,r):((n,t,e,o)=>function(...r){return n(t,e,o,r)})(n,t,e,o)},at=function(t,o,r,u){const c=r(...t),f=u(...t);return n(c)||n(f)?e([c,f]).then(Q(o)):o(c,f)},pt=function(t,o,r,u){const c=r(...t);return n(c)||n(u)?e([c,u]).then(Q(o)):o(c,u)},yt=function(t,o,r,u){const c=u(...t);return n(r)||n(c)?e([r,c]).then(Q(o)):o(r,c)},dt=o=>function(...r){const c=r.pop(),f=r.pop(),i="function"==typeof f,s="function"==typeof c;return i&&s?0==r.length?ht(at,u,o,f,c):t(r)?e(r).then(g(at,u,o,f,c)):at(r,o,f,c):i?0==r.length?ht(pt,u,o,f,c):t(r)?e(r).then(g(pt,u,o,f,c)):pt(r,o,f,c):s?0==r.length?ht(yt,u,o,f,c):t(r)?e(r).then(g(yt,u,o,f,c)):yt(r,o,f,c):n(f)||n(c)?e([f,c]).then(Q(o)):o(f,c)},gt=dt((function(n,t){return n==t})),wt=dt(((n,t)=>n>t)),vt=dt(((n,t)=>n<t)),bt=dt(((n,t)=>n>=t)),jt=dt(((n,t)=>n<=t)),xt=/[.|[|\]]+/,St=function(n,t){const e=new Map,o=function(o){if(e.has(o))return e.get(o);const r=n(o);return e.set(o,r),e.size>t&&e.clear(),r};return o.cache=e,o}((function(n){const t=n.length-1,e="["==n[0],o="]"==n[t];return e&&o?n.slice(1,t).split(xt):e?n.slice(1).split(xt):o?n.slice(0,t).split(xt):n.split(xt)}),500),Mt=n=>y(n)?n:"string"==typeof n?St(n):[n],mt=function(n,t){const e=Mt(t),o=e.length;let r=-1,u=n;for(;++r<o;)if(u=u[e[r]],null==u)return;return u},Ot=function(n,t,e){const o=null==n?void 0:mt(n,t);return void 0===o?"function"==typeof e?e(n):e:o},At=function(n,t,e){if(!(n=>{if(null==n)return!1;const t=typeof n;return"object"==t||"function"==t})(n))return n;const o=Mt(e),r=o.length,u=r-1,c={...n};let f=c,i=-1;for(;++i<r;){const n=o[i];if(i==u)f[n]=t;else{const t=f[n],e=y(t)?t.slice():{...t};f[n]=e,f=e}}return c},zt=function(t,e,o){if("function"==typeof o){const r=o(t);return n(r)?r.then(l(At,t,u,e)):At(t,r,e)}return n(o)?o.then(l(At,t,u,e)):At(t,o,e)},Et=function(n,t){if(null==n)return n;const e=t.length;let o={},r=-1;for(;++r<e;){const e=t[r],u=mt(n,e);null!=u&&(o=At(o,u,e))}return o},It=function(n,t){if(null==n)return;const e=Mt(t),o=e.length-1;let r=-1,u=n;for(;++r<o;)if(u=u[e[r]],null==u)return;const c=e[r];null!=u&&c in u&&delete u[c]},Dt=function(n){const t={};for(const e in n){const o=n[e];y(o)?t[e]=Pt(o):null!=o&&o.constructor==Object?t[e]=Dt(o):t[e]=o}return t},Pt=function(n){const t=n.length,e=[];let o=-1;for(;++o<t;){const t=n[o];y(t)?e[o]=Pt(t):null!=t&&t.constructor==Object?e[o]=Dt(t):e[o]=t}return e},Tt=function(n,t){const e=t.length,o=y(r=n)?Pt(r):null==r?r:r.constructor==Object?Dt(r):r;var r;let u=-1;for(;++u<e;)It(o,t[u]);return o},Bt=(n,...t)=>N(n.length,n,t);Bt.arity=function(n,t,...e){return N(n,t,e)};return{pipe:function(...n){const f=n.pop().reduce(o);return 0==n.length?f:t(n)?e(n).then(c(r,f,u)):f(...n)},compose:function(...n){const f=n.pop().reduceRight(o);return 0==n.length?f:t(n)?e(n).then(c(r,f,u)):f(...n)},tap:p,forEach:Nn,switchCase:(...n)=>{const o=n.pop();return E(o)?D(o,-2):0==n.length?(r=z,f=u,i=-2,(c=o)==u?((n,t,e)=>function(...o){return n(o,t,e)})(r,f,i):f==u?((n,t,e)=>function(...o){return n(t,o,e)})(r,c,i):((n,t,e)=>function(...o){return n(t,e,o)})(r,c,f)):t(n)?e(n).then(l(z,o,u,-2)):z(o,n,-2);var r,c,f,i},tryCatch:function(...n){if(n.length>2){const o=n.pop(),r=n.pop();return t(n)?e(n).then(l(O,r,o,u)):O(r,o,n)}const o=n[0],r=n[1];return function(...n){return O(o,r,n)}},all:x,assign:function(t,e){return null==e?c(M,u,t):n(t)?t.then(c(M,u,e)):M(t,e)},get:function(t,e,o){return"string"==typeof t||"number"==typeof t||y(t)?l(Ot,u,t,e):n(t)?t.then(l(Ot,u,e,o)):Ot(t,e,o)},set:function(t,e,o){return null==o?l(zt,u,t,e):n(t)?t.then(l(zt,u,e,o)):zt(t,e,o)},pick:function(t,e){return null==e?c(Et,u,t):n(t)?t.then(c(Et,u,e)):Et(t,e)},omit:function(t,e){return null==e?c(Tt,u,t):n(t)?t.then(c(Tt,u,e)):Tt(t,e)},map:Y,filter:function(n,t){return"function"==typeof n?c(ln,u,n):ln(n,t)},flatMap:(t,e)=>"function"==typeof t?c(Gn,u,t):n(t)?t.then(c(Gn,u,e)):Gn(t,e),reduce:function(...t){return"function"==typeof t[0]?l(vn,u,t[0],t[1]):n(t[0])?t[0].then(l(vn,u,t[1],t[2])):vn(t[0],t[1],t[2])},transform:function(...t){return"function"==typeof t[0]?l(Pn,u,t[0],t[1]):n(t[0])?t[0].then(l(Pn,u,t[1],t[2])):Pn(t[0],t[1],t[2])},and:function(...n){const o=n.pop();return E(o)?ot(o,-1):0==n.length?h(ut,u,o):t(n)?e(n).then(c(ut,u,o)):ut(n,o)},or:function(...n){const o=n.pop();return E(o)?ct(o,-1):0==n.length?h(it,u,o):t(n)?e(n).then(c(it,u,o)):it(n,o)},not:function(...n){const o=n.pop();return"function"==typeof o?0==n.length?h(lt,u,o):t(n)?e(n).then(c(lt,u,o)):lt(n,o):!o},some:function(t,e){return"function"==typeof t?c(Zn,u,t):n(t)?t.then(c(Zn,u,e)):Zn(t,e)},every:function(t,e){return"function"==typeof t?c(et,u,t):n(t)?t.then(c(et,u,e)):et(t,e)},eq:gt,gt:wt,lt:vt,gte:bt,lte:jt,thunkify:(n,...o)=>function(){return t(o)?e(o).then(c(r,n,u)):n(...o)},always:f,curry:Bt,__:u}}());
|
package/dist/rubico.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.4.
|
|
2
|
+
* rubico v2.4.2
|
|
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.
|
|
@@ -846,17 +846,13 @@ const _map = function (value, mapper) {
|
|
|
846
846
|
return mapper(value)
|
|
847
847
|
}
|
|
848
848
|
|
|
849
|
-
const map = (
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
return curry2(_map, __, mapper)
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
const collection = args[0]
|
|
856
|
-
if (isPromise(collection)) {
|
|
857
|
-
return collection.then(curry2(_map, __, mapper))
|
|
849
|
+
const map = function (arg0, arg1) {
|
|
850
|
+
if (typeof arg0 == 'function') {
|
|
851
|
+
return curry2(_map, __, arg0)
|
|
858
852
|
}
|
|
859
|
-
return
|
|
853
|
+
return isPromise(arg0)
|
|
854
|
+
? arg0.then(curry2(_map, __, arg1))
|
|
855
|
+
: _map(arg0, arg1)
|
|
860
856
|
}
|
|
861
857
|
|
|
862
858
|
// _mapEntries(value Object|Map, mapper function) -> Object|Map
|
|
@@ -873,17 +869,13 @@ const _mapEntries = (value, mapper) => {
|
|
|
873
869
|
throw new TypeError('value is not an Object or Map')
|
|
874
870
|
}
|
|
875
871
|
|
|
876
|
-
map.entries = function mapEntries(
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
return curry2(_mapEntries, __, mapper)
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
const collection = args[0]
|
|
883
|
-
if (isPromise(collection)) {
|
|
884
|
-
return collection.then(curry2(_mapEntries, __, mapper))
|
|
872
|
+
map.entries = function mapEntries(arg0, arg1) {
|
|
873
|
+
if (typeof arg0 == 'function') {
|
|
874
|
+
return curry2(_mapEntries, __, arg0)
|
|
885
875
|
}
|
|
886
|
-
return
|
|
876
|
+
return isPromise(arg0)
|
|
877
|
+
? arg0.then(curry2(_mapEntries, __, arg1))
|
|
878
|
+
: _mapEntries(arg0, arg1)
|
|
887
879
|
}
|
|
888
880
|
|
|
889
881
|
map.series = mapper => function mappingInSeries(value) {
|
|
@@ -1093,12 +1085,11 @@ const _filter = function (value, predicate) {
|
|
|
1093
1085
|
return value
|
|
1094
1086
|
}
|
|
1095
1087
|
|
|
1096
|
-
const filter = function (
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
return curry2(_filter, __, predicate)
|
|
1088
|
+
const filter = function (arg0, arg1) {
|
|
1089
|
+
if (typeof arg0 == 'function') {
|
|
1090
|
+
return curry2(_filter, __, arg0)
|
|
1100
1091
|
}
|
|
1101
|
-
return _filter(
|
|
1092
|
+
return _filter(arg0, arg1)
|
|
1102
1093
|
}
|
|
1103
1094
|
|
|
1104
1095
|
const objectValues = Object.values
|
|
@@ -1856,15 +1847,13 @@ const _flatMap = function (value, flatMapper) {
|
|
|
1856
1847
|
return flatMapper(value)
|
|
1857
1848
|
}
|
|
1858
1849
|
|
|
1859
|
-
const flatMap = (
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
return curry2(_flatMap, __, flatMapper)
|
|
1850
|
+
const flatMap = (arg0, arg1) => {
|
|
1851
|
+
if (typeof arg0 == 'function') {
|
|
1852
|
+
return curry2(_flatMap, __, arg0)
|
|
1863
1853
|
}
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
: _flatMap(args[0], flatMapper)
|
|
1854
|
+
return isPromise(arg0)
|
|
1855
|
+
? arg0.then(curry2(_flatMap, __, arg1))
|
|
1856
|
+
: _flatMap(arg0, arg1)
|
|
1868
1857
|
}
|
|
1869
1858
|
|
|
1870
1859
|
const arrayForEach = function (array, callback) {
|
|
@@ -2190,18 +2179,13 @@ const _some = function (collection, predicate) {
|
|
|
2190
2179
|
return predicate(collection)
|
|
2191
2180
|
}
|
|
2192
2181
|
|
|
2193
|
-
const some = function (
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
return curry2(_some, __, predicate)
|
|
2197
|
-
}
|
|
2198
|
-
|
|
2199
|
-
const collection = args[0]
|
|
2200
|
-
if (isPromise(collection)) {
|
|
2201
|
-
return collection.then(curry2(_some, __, predicate))
|
|
2182
|
+
const some = function (arg0, arg1) {
|
|
2183
|
+
if (typeof arg0 == 'function') {
|
|
2184
|
+
return curry2(_some, __, arg0)
|
|
2202
2185
|
}
|
|
2203
|
-
|
|
2204
|
-
|
|
2186
|
+
return isPromise(arg0)
|
|
2187
|
+
? arg0.then(curry2(_some, __, arg1))
|
|
2188
|
+
: _some(arg0, arg1)
|
|
2205
2189
|
}
|
|
2206
2190
|
|
|
2207
2191
|
const arrayEvery = function (array, predicate) {
|
|
@@ -2302,18 +2286,13 @@ const _every = function (collection, predicate) {
|
|
|
2302
2286
|
return predicate(collection)
|
|
2303
2287
|
}
|
|
2304
2288
|
|
|
2305
|
-
const every = function (
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
return curry2(_every, __, predicate)
|
|
2309
|
-
}
|
|
2310
|
-
|
|
2311
|
-
const collection = args[0]
|
|
2312
|
-
if (isPromise(collection)) {
|
|
2313
|
-
return collection.then(curry2(_every, __, predicate))
|
|
2289
|
+
const every = function (arg0, arg1) {
|
|
2290
|
+
if (typeof arg0 == 'function') {
|
|
2291
|
+
return curry2(_every, __, arg0)
|
|
2314
2292
|
}
|
|
2315
|
-
|
|
2316
|
-
|
|
2293
|
+
return isPromise(arg0)
|
|
2294
|
+
? arg0.then(curry2(_every, __, arg1))
|
|
2295
|
+
: _every(arg0, arg1)
|
|
2317
2296
|
}
|
|
2318
2297
|
|
|
2319
2298
|
const areAllValuesTruthy = function (predicates, index) {
|
package/dist/set.es.js
CHANGED
package/dist/set.es.min.js
CHANGED
package/dist/set.js
CHANGED
package/dist/set.min.js
CHANGED
package/dist/set.mjs
CHANGED
package/dist/some.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.4.
|
|
2
|
+
* rubico v2.4.2
|
|
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.
|
|
@@ -169,18 +169,13 @@ const _some = function (collection, predicate) {
|
|
|
169
169
|
return predicate(collection)
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
const some = function (
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
return curry2(_some, __, predicate)
|
|
172
|
+
const some = function (arg0, arg1) {
|
|
173
|
+
if (typeof arg0 == 'function') {
|
|
174
|
+
return curry2(_some, __, arg0)
|
|
176
175
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
return collection.then(curry2(_some, __, predicate))
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
return _some(collection, predicate)
|
|
176
|
+
return isPromise(arg0)
|
|
177
|
+
? arg0.then(curry2(_some, __, arg1))
|
|
178
|
+
: _some(arg0, arg1)
|
|
184
179
|
}
|
|
185
180
|
|
|
186
181
|
export default some
|
package/dist/some.es.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.4.
|
|
2
|
+
* rubico v2.4.2
|
|
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=e=>null!=e&&"function"==typeof e.then,__=Symbol.for("placeholder"),curry2ResolveArg0=(e,r)=>function(o){return e(o,r)},curry2ResolveArg1=(e,r)=>function(o){return e(r,o)},curry2=function(e,r,o){return r==__?curry2ResolveArg0(e,o):curry2ResolveArg1(e,r)},isArray=Array.isArray,objectValues=Object.values,SelfReferencingPromise=function(e){const r=e.then((e=>[e,r]));return r},promiseRace=Promise.race.bind(Promise),asyncArraySome=async function(e,r,o,t){const n=e.length;for(;++o<n;){const n=r(e[o]);if(isPromise(n))t.add(SelfReferencingPromise(n));else if(n)return!0}for(;t.size>0;){const[e,r]=await promiseRace(t);if(t.delete(r),e)return!0}return!1},arraySome=function(e,r){const o=e.length;let t=-1;for(;++t<o;){const o=r(e[t]);if(isPromise(o))return asyncArraySome(e,r,t,new Set([SelfReferencingPromise(o)]));if(o)return!0}return!1},asyncIteratorSome=async function(e,r,o,t=20){let n=e.next();for(isPromise(n)&&(n=await n);!n.done;){if(o.size>=t){const[e,r]=await promiseRace(o);if(o.delete(r),e)return!0}const s=r(n.value);if(isPromise(s))o.add(SelfReferencingPromise(s));else if(s)return!0;n=e.next(),isPromise(n)&&(n=await n)}for(;o.size>0;){const[e,r]=await promiseRace(o);if(o.delete(r),e)return!0}return!1},iteratorSome=function(e,r){for(const o of e){const t=r(o);if(isPromise(t))return asyncIteratorSome(e,r,new Set([SelfReferencingPromise(t)]));if(t)return!0}return!1},reducerAnySync=e=>function(r,o){return!!r||e(o)},reducerSome=e=>function(r,o){return!0===r?r:isPromise(r)?r.then(curry2(reducerAnySync(e),__,o)):!!r||e(o)},symbolIterator=Symbol.iterator,symbolAsyncIterator=Symbol.asyncIterator,_some=function(e,r){return isArray(e)?arraySome(e,r):null==e?r(e):"function"==typeof e[symbolIterator]?iteratorSome(e[symbolIterator](),r):"function"==typeof e[symbolAsyncIterator]?asyncIteratorSome(e[symbolAsyncIterator](),r,new Set):"function"==typeof e.reduce?e.reduce(reducerSome(r),!1):e.constructor==Object?arraySome(objectValues(e),r):r(e)},some=function(
|
|
7
|
+
const isPromise=e=>null!=e&&"function"==typeof e.then,__=Symbol.for("placeholder"),curry2ResolveArg0=(e,r)=>function(o){return e(o,r)},curry2ResolveArg1=(e,r)=>function(o){return e(r,o)},curry2=function(e,r,o){return r==__?curry2ResolveArg0(e,o):curry2ResolveArg1(e,r)},isArray=Array.isArray,objectValues=Object.values,SelfReferencingPromise=function(e){const r=e.then((e=>[e,r]));return r},promiseRace=Promise.race.bind(Promise),asyncArraySome=async function(e,r,o,t){const n=e.length;for(;++o<n;){const n=r(e[o]);if(isPromise(n))t.add(SelfReferencingPromise(n));else if(n)return!0}for(;t.size>0;){const[e,r]=await promiseRace(t);if(t.delete(r),e)return!0}return!1},arraySome=function(e,r){const o=e.length;let t=-1;for(;++t<o;){const o=r(e[t]);if(isPromise(o))return asyncArraySome(e,r,t,new Set([SelfReferencingPromise(o)]));if(o)return!0}return!1},asyncIteratorSome=async function(e,r,o,t=20){let n=e.next();for(isPromise(n)&&(n=await n);!n.done;){if(o.size>=t){const[e,r]=await promiseRace(o);if(o.delete(r),e)return!0}const s=r(n.value);if(isPromise(s))o.add(SelfReferencingPromise(s));else if(s)return!0;n=e.next(),isPromise(n)&&(n=await n)}for(;o.size>0;){const[e,r]=await promiseRace(o);if(o.delete(r),e)return!0}return!1},iteratorSome=function(e,r){for(const o of e){const t=r(o);if(isPromise(t))return asyncIteratorSome(e,r,new Set([SelfReferencingPromise(t)]));if(t)return!0}return!1},reducerAnySync=e=>function(r,o){return!!r||e(o)},reducerSome=e=>function(r,o){return!0===r?r:isPromise(r)?r.then(curry2(reducerAnySync(e),__,o)):!!r||e(o)},symbolIterator=Symbol.iterator,symbolAsyncIterator=Symbol.asyncIterator,_some=function(e,r){return isArray(e)?arraySome(e,r):null==e?r(e):"function"==typeof e[symbolIterator]?iteratorSome(e[symbolIterator](),r):"function"==typeof e[symbolAsyncIterator]?asyncIteratorSome(e[symbolAsyncIterator](),r,new Set):"function"==typeof e.reduce?e.reduce(reducerSome(r),!1):e.constructor==Object?arraySome(objectValues(e),r):r(e)},some=function(e,r){return"function"==typeof e?curry2(_some,__,e):isPromise(e)?e.then(curry2(_some,__,r)):_some(e,r)};export default some;
|
package/dist/some.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.4.
|
|
2
|
+
* rubico v2.4.2
|
|
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.
|
|
@@ -175,18 +175,13 @@ const _some = function (collection, predicate) {
|
|
|
175
175
|
return predicate(collection)
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
const some = function (
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
return curry2(_some, __, predicate)
|
|
178
|
+
const some = function (arg0, arg1) {
|
|
179
|
+
if (typeof arg0 == 'function') {
|
|
180
|
+
return curry2(_some, __, arg0)
|
|
182
181
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
return collection.then(curry2(_some, __, predicate))
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
return _some(collection, predicate)
|
|
182
|
+
return isPromise(arg0)
|
|
183
|
+
? arg0.then(curry2(_some, __, arg1))
|
|
184
|
+
: _some(arg0, arg1)
|
|
190
185
|
}
|
|
191
186
|
|
|
192
187
|
return some
|
package/dist/some.min.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.4.
|
|
2
|
+
* rubico v2.4.2
|
|
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(t,n){"object"==typeof module?module.exports=n:"function"==typeof define?define((()=>n)):t.some=n}("object"==typeof globalThis?globalThis:this,function(){"use strict";const t=t=>null!=t&&"function"==typeof t.then,n=Symbol.for("placeholder"),e=function(t,e,r){return e==n?((t,n)=>function(e){return t(e,n)})(t,r):((t,n)=>function(e){return t(n,e)})(t,e)},r=Array.isArray,o=Object.values,u=function(t){const n=t.then((t=>[t,n]));return n},i=Promise.race.bind(Promise),f=async function(n,e,r,o){const f=n.length;for(;++r<f;){const i=e(n[r]);if(t(i))o.add(u(i));else if(i)return!0}for(;o.size>0;){const[t,n]=await i(o);if(o.delete(n),t)return!0}return!1},c=function(n,e){const r=n.length;let o=-1;for(;++o<r;){const r=e(n[o]);if(t(r))return f(n,e,o,new Set([u(r)]));if(r)return!0}return!1},s=async function(n,e,r,o=20){let f=n.next();for(t(f)&&(f=await f);!f.done;){if(r.size>=o){const[t,n]=await i(r);if(r.delete(n),t)return!0}const c=e(f.value);if(t(c))r.add(u(c));else if(c)return!0;f=n.next(),t(f)&&(f=await f)}for(;r.size>0;){const[t,n]=await i(r);if(r.delete(n),t)return!0}return!1},l=Symbol.iterator,a=Symbol.asyncIterator,d=function(i,f){return r(i)?c(i,f):null==i?f(i):"function"==typeof i[l]?function(n,e){for(const r of n){const o=e(r);if(t(o))return s(n,e,new Set([u(o)]));if(o)return!0}return!1}(i[l](),f):"function"==typeof i[a]?s(i[a](),f,new Set):"function"==typeof i.reduce?i.reduce((r=>function(o,u){return!0===o?o:t(o)?o.then(e((t=>function(n,e){return!!n||t(e)})(r),n,u)):!!o||r(u)})(f),!1):i.constructor==Object?c(o(i),f):f(i)};return function(
|
|
8
|
+
!function(t,n){"object"==typeof module?module.exports=n:"function"==typeof define?define((()=>n)):t.some=n}("object"==typeof globalThis?globalThis:this,function(){"use strict";const t=t=>null!=t&&"function"==typeof t.then,n=Symbol.for("placeholder"),e=function(t,e,r){return e==n?((t,n)=>function(e){return t(e,n)})(t,r):((t,n)=>function(e){return t(n,e)})(t,e)},r=Array.isArray,o=Object.values,u=function(t){const n=t.then((t=>[t,n]));return n},i=Promise.race.bind(Promise),f=async function(n,e,r,o){const f=n.length;for(;++r<f;){const i=e(n[r]);if(t(i))o.add(u(i));else if(i)return!0}for(;o.size>0;){const[t,n]=await i(o);if(o.delete(n),t)return!0}return!1},c=function(n,e){const r=n.length;let o=-1;for(;++o<r;){const r=e(n[o]);if(t(r))return f(n,e,o,new Set([u(r)]));if(r)return!0}return!1},s=async function(n,e,r,o=20){let f=n.next();for(t(f)&&(f=await f);!f.done;){if(r.size>=o){const[t,n]=await i(r);if(r.delete(n),t)return!0}const c=e(f.value);if(t(c))r.add(u(c));else if(c)return!0;f=n.next(),t(f)&&(f=await f)}for(;r.size>0;){const[t,n]=await i(r);if(r.delete(n),t)return!0}return!1},l=Symbol.iterator,a=Symbol.asyncIterator,d=function(i,f){return r(i)?c(i,f):null==i?f(i):"function"==typeof i[l]?function(n,e){for(const r of n){const o=e(r);if(t(o))return s(n,e,new Set([u(o)]));if(o)return!0}return!1}(i[l](),f):"function"==typeof i[a]?s(i[a](),f,new Set):"function"==typeof i.reduce?i.reduce((r=>function(o,u){return!0===o?o:t(o)?o.then(e((t=>function(n,e){return!!n||t(e)})(r),n,u)):!!o||r(u)})(f),!1):i.constructor==Object?c(o(i),f):f(i)};return function(r,o){return"function"==typeof r?e(d,n,r):t(r)?r.then(e(d,n,o)):d(r,o)}}());
|
package/dist/some.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.4.
|
|
2
|
+
* rubico v2.4.2
|
|
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.
|
|
@@ -169,18 +169,13 @@ const _some = function (collection, predicate) {
|
|
|
169
169
|
return predicate(collection)
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
const some = function (
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
return curry2(_some, __, predicate)
|
|
172
|
+
const some = function (arg0, arg1) {
|
|
173
|
+
if (typeof arg0 == 'function') {
|
|
174
|
+
return curry2(_some, __, arg0)
|
|
176
175
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
return collection.then(curry2(_some, __, predicate))
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
return _some(collection, predicate)
|
|
176
|
+
return isPromise(arg0)
|
|
177
|
+
? arg0.then(curry2(_some, __, arg1))
|
|
178
|
+
: _some(arg0, arg1)
|
|
184
179
|
}
|
|
185
180
|
|
|
186
181
|
export default some
|
package/dist/switchCase.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.4.
|
|
2
|
+
* rubico v2.4.2
|
|
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=
|
|
7
|
+
const promiseAll=Promise.all.bind(Promise),isPromise=n=>null!=n&&"function"==typeof n.then,areAnyValuesPromises=function(n){const r=n.length;let t=-1;for(;++t<r;){const r=n[t];if(isPromise(r))return!0}return!1},thunkConditional=(n,r,t)=>n?r():t(),thunkifyArgs=(n,r)=>function(){return n(...r)},thunkify3=(n,r,t,o)=>function(){return n(r,t,o)},__=Symbol.for("placeholder"),curry3ResolveArg0=(n,r,t)=>function(o){return n(o,r,t)},curry3ResolveArg1=(n,r,t)=>function(o){return n(r,o,t)},curry3ResolveArg2=(n,r,t)=>function(o){return n(r,t,o)},curry3=function(n,r,t,o){return r==__?curry3ResolveArg0(n,t,o):t==__?curry3ResolveArg1(n,r,o):curry3ResolveArg2(n,r,t)},always=n=>function(){return n},arrayConditional=function(n,r,t){const o=n.length-1;for(;(t+=2)<o;){const o=n[t],e=n[t+1],u="function"==typeof o?o(...r):o;if(isPromise(u))return u.then(curry3(thunkConditional,__,"function"==typeof e?thunkifyArgs(e,r):always(e),thunkify3(arrayConditional,n,r,t)));if(u)return"function"==typeof e?e(...r):e}if(t==n.length)return;const e=n[o];return"function"==typeof e?e(...r):e},areAllValuesNonfunctions=function(n){const r=n.length;let t=-1;for(;++t<r;)if("function"==typeof n[t])return!1;return!0},thunkify2=(n,r,t)=>function(){return n(r,t)},nonfunctionsConditional=function(n,r){const t=n.length,o=t-1;for(;(r+=2)<o;){const t=n[r],o=n[r+1];if(isPromise(t))return t.then(curry3(thunkConditional,__,always(o),thunkify2(nonfunctionsConditional,n,r)));if(t)return o}if(r!=t)return n[r]},curryArgs3ResolveArgs0=(n,r,t)=>function(...o){return n(o,r,t)},curryArgs3ResolveArgs1=(n,r,t)=>function(...o){return n(r,o,t)},curryArgs3ResolveArgs2=(n,r,t)=>function(...o){return n(r,t,o)},curryArgs3=function(n,r,t,o){return r==__?curryArgs3ResolveArgs0(n,t,o):t==__?curryArgs3ResolveArgs1(n,r,o):curryArgs3ResolveArgs2(n,r,t)},switchCase=(...n)=>{const r=n.pop();return areAllValuesNonfunctions(r)?nonfunctionsConditional(r,-2):0==n.length?curryArgs3(arrayConditional,r,__,-2):areAnyValuesPromises(n)?promiseAll(n).then(curry3(arrayConditional,r,__,-2)):arrayConditional(r,n,-2)};export default switchCase;
|
package/dist/switchCase.js
CHANGED