rubico 2.3.8 → 2.4.1
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/dist/Transducer.es.js +1 -1
- package/dist/Transducer.es.min.js +1 -1
- 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 +1 -1
- package/dist/all.js +1 -1
- package/dist/all.min.js +1 -1
- 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 +1 -1
- package/dist/and.js +1 -1
- package/dist/and.min.js +1 -1
- package/dist/and.mjs +1 -1
- package/dist/assign.es.js +1 -1
- package/dist/assign.es.min.js +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/not.js +1 -1
- package/dist/not.min.js +1 -1
- package/dist/not.mjs +1 -1
- package/dist/omit.es.js +1 -1
- package/dist/omit.es.min.js +1 -1
- 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 +1 -1
- package/dist/or.js +1 -1
- package/dist/or.min.js +1 -1
- package/dist/or.mjs +1 -1
- package/dist/pick.es.js +1 -1
- package/dist/pick.es.min.js +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/tap.js +1 -1
- package/dist/tap.min.js +1 -1
- package/dist/tap.mjs +1 -1
- package/dist/thunkify.es.js +1 -1
- package/dist/thunkify.es.min.js +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/x/trace.js +1 -1
- package/dist/x/trace.min.js +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- package/some.js +6 -12
package/dist/tryCatch.es.min.js
CHANGED
package/dist/tryCatch.js
CHANGED
package/dist/tryCatch.min.js
CHANGED
package/dist/tryCatch.mjs
CHANGED
package/dist/x/append.es.js
CHANGED
package/dist/x/append.es.min.js
CHANGED
package/dist/x/append.js
CHANGED
package/dist/x/append.min.js
CHANGED
package/dist/x/append.mjs
CHANGED
package/dist/x/callProp.es.js
CHANGED
package/dist/x/callProp.js
CHANGED
package/dist/x/callProp.min.js
CHANGED
package/dist/x/callProp.mjs
CHANGED
package/dist/x/defaultsDeep.js
CHANGED
package/dist/x/defaultsDeep.mjs
CHANGED
package/dist/x/differenceWith.js
CHANGED
package/dist/x/filterOut.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.
|
|
2
|
+
* rubico v2.4.1
|
|
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.
|
|
@@ -311,12 +311,11 @@ const _filter = function (value, predicate) {
|
|
|
311
311
|
return value
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
-
const filter = function (
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
return curry2(_filter, __, predicate)
|
|
314
|
+
const filter = function (arg0, arg1) {
|
|
315
|
+
if (typeof arg0 == 'function') {
|
|
316
|
+
return curry2(_filter, __, arg0)
|
|
318
317
|
}
|
|
319
|
-
return _filter(
|
|
318
|
+
return _filter(arg0, arg1)
|
|
320
319
|
}
|
|
321
320
|
|
|
322
321
|
const areAnyValuesPromises = function (values) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.
|
|
2
|
+
* rubico v2.4.1
|
|
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 __=Symbol.for("placeholder"),curry2ResolveArg0=(r,t)=>function(n){return r(n,t)},curry2ResolveArg1=(r,t)=>function(n){return r(t,n)},curry2=function(r,t,n){return t==__?curry2ResolveArg0(r,n):curry2ResolveArg1(r,t)},symbolIterator=Symbol.iterator,FilteringIterator=(r,t)=>({[symbolIterator](){return this},next(){let n=r.next();for(;!n.done;){const{value:e}=n;if(t(e))return{value:e,done:!1};n=r.next()}return n}}),isPromise=r=>null!=r&&"function"==typeof r.then,symbolAsyncIterator=Symbol.asyncIterator,FilteringAsyncIterator=(r,t)=>({isAsyncIteratorDone:!1,[symbolAsyncIterator](){return this},async next(){for(;!this.isAsyncIteratorDone;){const{value:n,done:e}=await r.next();if(e)this.isAsyncIteratorDone=!0;else{const r=t(n);if(isPromise(r)?await r:r)return{value:n,done:!1}}}return{value:void 0,done:!0}}}),isArray=Array.isArray,curry4ResolveArg0=(r,t,n,e)=>function(o){return r(o,t,n,e)},curry4ResolveArg1=(r,t,n,e)=>function(o){return r(t,o,n,e)},curry4ResolveArg2=(r,t,n,e)=>function(o){return r(t,n,o,e)},curry4ResolveArg3=(r,t,n,e)=>function(o){return r(t,n,e,o)},curry4=function(r,t,n,e,o){return t==__?curry4ResolveArg0(r,n,e,o):n==__?curry4ResolveArg1(r,t,e,o):e==__?curry4ResolveArg2(r,t,n,o):curry4ResolveArg3(r,t,n,e)},promiseAll=Promise.all.bind(Promise),arrayExtendMap=function(r,t,n,e){const o=t.length;let
|
|
7
|
+
const __=Symbol.for("placeholder"),curry2ResolveArg0=(r,t)=>function(n){return r(n,t)},curry2ResolveArg1=(r,t)=>function(n){return r(t,n)},curry2=function(r,t,n){return t==__?curry2ResolveArg0(r,n):curry2ResolveArg1(r,t)},symbolIterator=Symbol.iterator,FilteringIterator=(r,t)=>({[symbolIterator](){return this},next(){let n=r.next();for(;!n.done;){const{value:e}=n;if(t(e))return{value:e,done:!1};n=r.next()}return n}}),isPromise=r=>null!=r&&"function"==typeof r.then,symbolAsyncIterator=Symbol.asyncIterator,FilteringAsyncIterator=(r,t)=>({isAsyncIteratorDone:!1,[symbolAsyncIterator](){return this},async next(){for(;!this.isAsyncIteratorDone;){const{value:n,done:e}=await r.next();if(e)this.isAsyncIteratorDone=!0;else{const r=t(n);if(isPromise(r)?await r:r)return{value:n,done:!1}}}return{value:void 0,done:!0}}}),isArray=Array.isArray,curry4ResolveArg0=(r,t,n,e)=>function(o){return r(o,t,n,e)},curry4ResolveArg1=(r,t,n,e)=>function(o){return r(t,o,n,e)},curry4ResolveArg2=(r,t,n,e)=>function(o){return r(t,n,o,e)},curry4ResolveArg3=(r,t,n,e)=>function(o){return r(t,n,e,o)},curry4=function(r,t,n,e,o){return t==__?curry4ResolveArg0(r,n,e,o):n==__?curry4ResolveArg1(r,t,e,o):e==__?curry4ResolveArg2(r,t,n,o):curry4ResolveArg3(r,t,n,e)},promiseAll=Promise.all.bind(Promise),arrayExtendMap=function(r,t,n,e){const o=t.length;let i=r.length-1;for(;++e<o;)r[++i]=n(t[e],e,r);return r},arrayFilterByConditions=function(r,t,n,e){const o=r.length;let i=-1;for(;++n<o;)e[++i]&&t.push(r[n]);return t},arrayFilter=function(r,t){const n=r.length,e=[];let o=-1,i=-1;for(;++o<n;){const n=r[o],s=t(n,o,r);if(isPromise(s))return promiseAll(arrayExtendMap([s],r,t,o)).then(curry4(arrayFilterByConditions,r,e,o-1,__));s&&(e[++i]=n)}return e},curry3ResolveArg0=(r,t,n)=>function(e){return r(e,t,n)},curry3ResolveArg1=(r,t,n)=>function(e){return r(t,e,n)},curry3ResolveArg2=(r,t,n)=>function(e){return r(t,n,e)},curry3=function(r,t,n,e){return t==__?curry3ResolveArg0(r,n,e):n==__?curry3ResolveArg1(r,t,e):curry3ResolveArg2(r,t,n)},callPropUnary=(r,t,n)=>r[t](n),stringFilter=function(r,t){const n=arrayFilter(r,t);return isPromise(n)?n.then(curry3(callPropUnary,__,"join","")):n.join("")},always=r=>function(){return r},thunkConditional=(r,t,n)=>r?t():n(),thunkify1=(r,t)=>function(){return r(t)},noop=function(){},setFilter=function(r,t){const n=new Set,e=n.add.bind(n),o=[];for(const i of r){const s=t(i,i,r);isPromise(s)?o.push(s.then(curry3(thunkConditional,__,thunkify1(e,i),noop))):s&&n.add(i)}return 0==o.length?n:promiseAll(o).then(always(n))},thunkify4=(r,t,n,e,o)=>function(){return r(t,n,e,o)},callPropBinary=(r,t,n,e)=>r[t](n,e),mapFilter=function(r,t){const n=new Map,e=[];for(const[o,i]of r){const s=t(i,o,r);isPromise(s)?e.push(s.then(curry3(thunkConditional,__,thunkify4(callPropBinary,n,"set",o,i),noop))):s&&n.set(o,i)}return 0==e.length?n:promiseAll(e).then(always(n))},objectSetIf=function(r,t,n,e){e&&(r[t]=n)},objectFilter=function(r,t){const n={},e=[];for(const o in r){const i=r[o],s=t(i,o,r);isPromise(s)?e.push(s.then(curry4(objectSetIf,n,o,r[o],__))):s&&(n[o]=i)}return 0==e.length?n:promiseAll(e).then(always(n))},_filter=function(r,t){return isArray(r)?arrayFilter(r,t):null==r?r:"string"==typeof r||r.constructor==String?stringFilter(r,t):r.constructor==Set?setFilter(r,t):r.constructor==Map?mapFilter(r,t):"function"==typeof r.filter?r.filter(t):"function"==typeof r[symbolIterator]?FilteringIterator(r[symbolIterator](),t):"function"==typeof r[symbolAsyncIterator]?FilteringAsyncIterator(r[symbolAsyncIterator](),t):r.constructor==Object?objectFilter(r,t):r},filter=function(r,t){return"function"==typeof r?curry2(_filter,__,r):_filter(r,t)},areAnyValuesPromises=function(r){const t=r.length;let n=-1;for(;++n<t;){const t=r[n];if(isPromise(t))return!0}return!1},curryArgs2ResolveArgs0=(r,t,n)=>function(...n){return r(n,t)},curryArgs2ResolveArgs1=(r,t,n)=>function(...n){return r(t,n)},curryArgs2=function(r,t,n){return t==__?curryArgs2ResolveArgs0(r,n):curryArgs2ResolveArgs1(r,t)},negate=r=>!r,_not=function(r,t){const n=t(...r);return isPromise(n)?n.then(negate):!n},not=function(...r){const t=r.pop();return"function"==typeof t?0==r.length?(n=_not,o=t,(e=__)==__?curryArgs2ResolveArgs0(n,o):curryArgs2ResolveArgs1(n,e)):areAnyValuesPromises(r)?promiseAll(r).then(curry2(_not,__,t)):_not(r,t):!t;var n,e,o},filterOut=r=>{return"function"==typeof(t=not(r))?curry2(_filter,__,t):_filter(t,n);var t,n};export default filterOut;
|
package/dist/x/filterOut.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.
|
|
2
|
+
* rubico v2.4.1
|
|
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.
|
|
@@ -317,12 +317,11 @@ const _filter = function (value, predicate) {
|
|
|
317
317
|
return value
|
|
318
318
|
}
|
|
319
319
|
|
|
320
|
-
const filter = function (
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
return curry2(_filter, __, predicate)
|
|
320
|
+
const filter = function (arg0, arg1) {
|
|
321
|
+
if (typeof arg0 == 'function') {
|
|
322
|
+
return curry2(_filter, __, arg0)
|
|
324
323
|
}
|
|
325
|
-
return _filter(
|
|
324
|
+
return _filter(arg0, arg1)
|
|
326
325
|
}
|
|
327
326
|
|
|
328
327
|
const areAnyValuesPromises = function (values) {
|
package/dist/x/filterOut.min.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.
|
|
2
|
+
* rubico v2.4.1
|
|
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.filterOut=t}("object"==typeof globalThis?globalThis:this,function(){"use strict";const n=Symbol.for("placeholder"),t=function(t,e,o){return e==n?((n,t)=>function(e){return n(e,t)})(t,o):((n,t)=>function(e){return n(t,e)})(t,e)},e=Symbol.iterator,o=(n,t)=>({[e](){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}}),r=n=>null!=n&&"function"==typeof n.then,u=Symbol.asyncIterator,c=(n,t)=>({isAsyncIteratorDone:!1,[u](){return this},async next(){for(;!this.isAsyncIteratorDone;){const{value:e,done:o}=await n.next();if(o)this.isAsyncIteratorDone=!0;else{const n=t(e);if(r(n)?await n:n)return{value:e,done:!1}}}return{value:void 0,done:!0}}}),i=Array.isArray,f=function(t,e,o,r,u){return e==n?((n,t,e,o)=>function(r){return n(r,t,e,o)})(t,o,r,u):o==n?((n,t,e,o)=>function(r){return n(t,r,e,o)})(t,e,r,u):r==n?((n,t,e,o)=>function(r){return n(t,e,r,o)})(t,e,o,u):((n,t,e,o)=>function(r){return n(t,e,o,r)})(t,e,o,r)},s=Promise.all.bind(Promise),l=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},h=function(n,t,e,o){const r=n.length;let u=-1;for(;++e<r;)o[++u]&&t.push(n[e]);return t},a=function(t,e){const o=t.length,u=[];let c=-1,i=-1;for(;++c<o;){const o=t[c],a=e(o,c,t);if(r(a))return s(l([a],t,e,c)).then(f(h,t,u,c-1,n));a&&(u[++i]=o)}return u},p=function(t,e,o,r){return e==n?((n,t,e)=>function(o){return n(o,t,e)})(t,o,r):o==n?((n,t,e)=>function(o){return n(t,o,e)})(t,e,r):((n,t,e)=>function(o){return n(t,e,o)})(t,e,o)},y=(n,t,e)=>n[t](e),d=n=>function(){return n},g=(n,t,e)=>n?t():e(),b=(n,t)=>function(){return n(t)},
|
|
8
|
+
!function(n,t){"object"==typeof module?module.exports=t:"function"==typeof define?define((()=>t)):n.filterOut=t}("object"==typeof globalThis?globalThis:this,function(){"use strict";const n=Symbol.for("placeholder"),t=function(t,e,o){return e==n?((n,t)=>function(e){return n(e,t)})(t,o):((n,t)=>function(e){return n(t,e)})(t,e)},e=Symbol.iterator,o=(n,t)=>({[e](){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}}),r=n=>null!=n&&"function"==typeof n.then,u=Symbol.asyncIterator,c=(n,t)=>({isAsyncIteratorDone:!1,[u](){return this},async next(){for(;!this.isAsyncIteratorDone;){const{value:e,done:o}=await n.next();if(o)this.isAsyncIteratorDone=!0;else{const n=t(e);if(r(n)?await n:n)return{value:e,done:!1}}}return{value:void 0,done:!0}}}),i=Array.isArray,f=function(t,e,o,r,u){return e==n?((n,t,e,o)=>function(r){return n(r,t,e,o)})(t,o,r,u):o==n?((n,t,e,o)=>function(r){return n(t,r,e,o)})(t,e,r,u):r==n?((n,t,e,o)=>function(r){return n(t,e,r,o)})(t,e,o,u):((n,t,e,o)=>function(r){return n(t,e,o,r)})(t,e,o,r)},s=Promise.all.bind(Promise),l=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},h=function(n,t,e,o){const r=n.length;let u=-1;for(;++e<r;)o[++u]&&t.push(n[e]);return t},a=function(t,e){const o=t.length,u=[];let c=-1,i=-1;for(;++c<o;){const o=t[c],a=e(o,c,t);if(r(a))return s(l([a],t,e,c)).then(f(h,t,u,c-1,n));a&&(u[++i]=o)}return u},p=function(t,e,o,r){return e==n?((n,t,e)=>function(o){return n(o,t,e)})(t,o,r):o==n?((n,t,e)=>function(o){return n(t,o,e)})(t,e,r):((n,t,e)=>function(o){return n(t,e,o)})(t,e,o)},y=(n,t,e)=>n[t](e),d=n=>function(){return n},g=(n,t,e)=>n?t():e(),b=(n,t)=>function(){return n(t)},v=function(){},m=(n,t,e,o,r)=>function(){return n(t,e,o,r)},x=(n,t,e,o)=>n[t](e,o),S=function(n,t,e,o){o&&(n[t]=e)},j=function(t,l){return i(t)?a(t,l):null==t?t:"string"==typeof t||t.constructor==String?function(t,e){const o=a(t,e);return r(o)?o.then(p(y,n,"join","")):o.join("")}(t,l):t.constructor==Set?function(t,e){const o=new Set,u=o.add.bind(o),c=[];for(const i of t){const f=e(i,i,t);r(f)?c.push(f.then(p(g,n,b(u,i),v))):f&&o.add(i)}return 0==c.length?o:s(c).then(d(o))}(t,l):t.constructor==Map?function(t,e){const o=new Map,u=[];for(const[c,i]of t){const f=e(i,c,t);r(f)?u.push(f.then(p(g,n,m(x,o,"set",c,i),v))):f&&o.set(c,i)}return 0==u.length?o:s(u).then(d(o))}(t,l):"function"==typeof t.filter?t.filter(l):"function"==typeof t[e]?o(t[e](),l):"function"==typeof t[u]?c(t[u](),l):t.constructor==Object?function(t,e){const o={},u=[];for(const c in t){const i=t[c],s=e(i,c,t);r(s)?u.push(s.then(f(S,o,c,t[c],n))):s&&(o[c]=i)}return 0==u.length?o:s(u).then(d(o))}(t,l):t},A=n=>!n,w=function(n,t){const e=t(...n);return r(e)?e.then(A):!e},I=function(...e){const o=e.pop();return"function"==typeof o?0==e.length?(u=w,i=o,(c=n)==n?((n,t,e)=>function(...e){return n(e,t)})(u,i):((n,t,e)=>function(...e){return n(t,e)})(u,c)):function(n){const t=n.length;let e=-1;for(;++e<t;){const t=n[e];if(r(t))return!0}return!1}(e)?s(e).then(t(w,n,o)):w(e,o):!o;var u,c,i};return e=>{return"function"==typeof(o=I(e))?t(j,n,o):j(o,r);var o,r}}());
|
package/dist/x/filterOut.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.
|
|
2
|
+
* rubico v2.4.1
|
|
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.
|
|
@@ -311,12 +311,11 @@ const _filter = function (value, predicate) {
|
|
|
311
311
|
return value
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
-
const filter = function (
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
return curry2(_filter, __, predicate)
|
|
314
|
+
const filter = function (arg0, arg1) {
|
|
315
|
+
if (typeof arg0 == 'function') {
|
|
316
|
+
return curry2(_filter, __, arg0)
|
|
318
317
|
}
|
|
319
|
-
return _filter(
|
|
318
|
+
return _filter(arg0, arg1)
|
|
320
319
|
}
|
|
321
320
|
|
|
322
321
|
const areAnyValuesPromises = function (values) {
|
package/dist/x/find.es.js
CHANGED
package/dist/x/find.es.min.js
CHANGED
package/dist/x/find.js
CHANGED
package/dist/x/find.min.js
CHANGED
package/dist/x/find.mjs
CHANGED
package/dist/x/findIndex.es.js
CHANGED
package/dist/x/findIndex.js
CHANGED
package/dist/x/findIndex.min.js
CHANGED
package/dist/x/findIndex.mjs
CHANGED
package/dist/x/first.es.js
CHANGED
package/dist/x/first.es.min.js
CHANGED
package/dist/x/first.js
CHANGED
package/dist/x/first.min.js
CHANGED
package/dist/x/first.mjs
CHANGED
package/dist/x/flatten.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.
|
|
2
|
+
* rubico v2.4.1
|
|
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.
|
|
@@ -809,15 +809,13 @@ const _flatMap = function (value, flatMapper) {
|
|
|
809
809
|
return flatMapper(value)
|
|
810
810
|
}
|
|
811
811
|
|
|
812
|
-
const flatMap = (
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
return curry2(_flatMap, __, flatMapper)
|
|
812
|
+
const flatMap = (arg0, arg1) => {
|
|
813
|
+
if (typeof arg0 == 'function') {
|
|
814
|
+
return curry2(_flatMap, __, arg0)
|
|
816
815
|
}
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
: _flatMap(args[0], flatMapper)
|
|
816
|
+
return isPromise(arg0)
|
|
817
|
+
? arg0.then(curry2(_flatMap, __, arg1))
|
|
818
|
+
: _flatMap(arg0, arg1)
|
|
821
819
|
}
|
|
822
820
|
|
|
823
821
|
const flatten = function (value) {
|
package/dist/x/flatten.es.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.
|
|
2
|
+
* rubico v2.4.1
|
|
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 isArray=Array.isArray,__=Symbol.for("placeholder"),arrayPush=function(e,r){return e.push(r),e},always=e=>function(){return e},curry2ResolveArg0=(e,r)=>function(t){return e(t,r)},curry2ResolveArg1=(e,r)=>function(t){return e(r,t)},curry2=function(e,r,t){return r==__?curry2ResolveArg0(e,t):curry2ResolveArg1(e,r)},getArg1=(e,r)=>r,identity=e=>e,isPromise=e=>null!=e&&"function"==typeof e.then,promiseAll=Promise.all.bind(Promise),funcConcatSync=(e,r)=>function(...t){return r(e(...t))},asyncIteratorForEach=async function(e,r){const t=[];for await(const n of e){const e=r(n);isPromise(e)&&t.push(e)}return 0==t.length?e:promiseAll(t).then(always(e))},symbolIterator=Symbol.iterator,symbolAsyncIterator=Symbol.asyncIterator,arrayFlatten=function(e){const r=e.length,t=[],n=[];let o=-1;for(;++o<r;){const r=e[o];if(isArray(r)){const e=r.length;let t=-1;for(;++t<e;)n.push(r[t])}else if(null==r)n.push(r);else if("function"==typeof r.then)t.push(r.then(curry2(arrayPush,n,__)));else if("function"==typeof r[symbolIterator])for(const e of r)n.push(e);else if("function"==typeof r[symbolAsyncIterator])t.push(asyncIteratorForEach(r[symbolAsyncIterator](),curry2(arrayPush,n,__)));else if("function"==typeof r.chain){const e=r.chain(identity);isPromise(e)?t.push(e.then(curry2(arrayPush,n,__))):n.push(e)}else if("function"==typeof r.flatMap){const e=r.flatMap(identity);isPromise(e)?t.push(e.then(curry2(arrayPush,n,__))):n.push(e)}else if("function"==typeof r.reduce){const e=r.reduce(funcConcatSync(getArg1,curry2(arrayPush,n,__)),null);isPromise(e)&&t.push(e)}else if(r.constructor==Object)for(const e in r)n.push(r[e]);else n.push(r)}return 0==t.length?n:promiseAll(t).then(always(n))},curry3ResolveArg0=(e,r,t)=>function(n){return e(n,r,t)},curry3ResolveArg1=(e,r,t)=>function(n){return e(r,n,t)},curry3ResolveArg2=(e,r,t)=>function(n){return e(r,t,n)},curry3=function(e,r,t,n){return r==__?curry3ResolveArg0(e,t,n):t==__?curry3ResolveArg1(e,r,n):curry3ResolveArg2(e,r,t)},callPropUnary=(e,r,t)=>e[r](t),setFlatten=function(e){e.size;const r=[],t=new Set,n=(e,r)=>t.add(r),o=curry3(callPropUnary,t,"add",__);for(const c of e)if(isArray(c)){const e=c.length;let r=-1;for(;++r<e;)t.add(c[r])}else if(null==c)t.add(c);else if("function"==typeof c[symbolIterator])for(const e of c)t.add(e);else if("function"==typeof c[symbolAsyncIterator])r.push(asyncIteratorForEach(c[symbolAsyncIterator](),o));else if("function"==typeof c.chain){const e=c.chain(identity);isPromise(e)?r.push(e.then(o)):t.add(e)}else if("function"==typeof c.flatMap){const e=c.flatMap(identity);isPromise(e)?r.push(e.then(o)):t.add(e)}else if("function"==typeof c.reduce){const e=c.reduce(n,null);isPromise(e)&&r.push(e)}else if(c.constructor==Object)for(const e in c)t.add(c[e]);else t.add(c);return 0==r.length?t:promiseAll(r).then((()=>t))},objectAssign=Object.assign,objectFlatten=function(e){const r=[],t={},n=curry2(objectAssign,t,__),o=funcConcatSync(getArg1,n);for(const c in e){const s=e[c];if(null!=s)if("function"==typeof s[symbolIterator])for(const e of s)objectAssign(t,e);else if("function"==typeof s[symbolAsyncIterator])r.push(asyncIteratorForEach(s[symbolAsyncIterator](),n));else if("function"==typeof s.chain){const e=s.chain(identity);isPromise(e)?r.push(e.then(n)):objectAssign(t,e)}else if("function"==typeof s.flatMap){const e=s.flatMap(identity);isPromise(e)?r.push(e.then(n)):n(e)}else if("function"==typeof s.reduce){const e=s.reduce(o,null);isPromise(e)&&r.push(e)}else objectAssign(t,s)}return 0==r.length?t:promiseAll(r).then((()=>t))},objectValues=Object.values,objectProto=Object.prototype,nativeObjectToString=objectProto.toString,objectToString=e=>nativeObjectToString.call(e),generatorFunctionTag="[object GeneratorFunction]",isGeneratorFunction=e=>objectToString(e)==generatorFunctionTag,asyncGeneratorFunctionTag="[object AsyncGeneratorFunction]",isAsyncGeneratorFunction=e=>objectToString(e)==asyncGeneratorFunctionTag,iteratorReduceAsync=async function(e,r,t){let n=e.next();if(n.done)return t;for(;!n.done;)t=r(t,n.value),isPromise(t)&&(t=await t),n=e.next();return t},iteratorReduce=function(e,r,t){let n=e.next();if(n.done)return t;for(void 0===t&&(t=n.value,n=e.next());!n.done;){if(t=r(t,n.value),isPromise(t))return t.then(curry3(iteratorReduceAsync,e,r,__));n=e.next()}return t},asyncIteratorReduce=async function(e,r,t){let n=await e.next();if(n.done)return t;for(void 0===t&&(t=n.value,n=await e.next());!n.done;)t=await r(t,n.value),n=await e.next();return t},curryArgs3ResolveArgs0=(e,r,t)=>function(...n){return e(n,r,t)},curryArgs3ResolveArgs1=(e,r,t)=>function(...n){return e(r,n,t)},curryArgs3ResolveArgs2=(e,r,t)=>function(...n){return e(r,t,n)},curryArgs3=function(e,r,t,n){return r==__?curryArgs3ResolveArgs0(e,t,n):t==__?curryArgs3ResolveArgs1(e,r,n):curryArgs3ResolveArgs2(e,r,t)},curry4ResolveArg0=(e,r,t,n)=>function(o){return e(o,r,t,n)},curry4ResolveArg1=(e,r,t,n)=>function(o){return e(r,o,t,n)},curry4ResolveArg2=(e,r,t,n)=>function(o){return e(r,t,o,n)},curry4ResolveArg3=(e,r,t,n)=>function(o){return e(r,t,n,o)},curry4=function(e,r,t,n,o){return r==__?curry4ResolveArg0(e,t,n,o):t==__?curry4ResolveArg1(e,r,n,o):n==__?curry4ResolveArg2(e,r,t,o):curry4ResolveArg3(e,r,t,n)},arrayReduceAsync=async function(e,r,t,n){const o=e.length;for(;++n<o;)t=r(t,e[n],n,e),isPromise(t)&&(t=await t);return t},arrayReduce=function(e,r,t){const n=e.length;let o=-1;for(void 0===t&&(t=e[++o]);++o<n;)if(t=r(t,e[o],o,e),isPromise(t))return t.then(curry4(arrayReduceAsync,e,r,__,o));return t},curry5ResolveArg0=(e,r,t,n,o)=>function(c){return e(c,r,t,n,o)},curry5ResolveArg1=(e,r,t,n,o)=>function(c){return e(r,c,t,n,o)},curry5ResolveArg2=(e,r,t,n,o)=>function(c){return e(r,t,c,n,o)},curry5ResolveArg3=(e,r,t,n,o)=>function(c){return e(r,t,n,c,o)},curry5ResolveArg4=(e,r,t,n,o)=>function(c){return e(r,t,n,o,c)},curry5=function(e,r,t,n,o,c){return r==__?curry5ResolveArg0(e,t,n,o,c):t==__?curry5ResolveArg1(e,r,n,o,c):n==__?curry5ResolveArg2(e,r,t,o,c):o==__?curry5ResolveArg3(e,r,t,n,c):curry5ResolveArg4(e,r,t,n,o)},objectKeys=Object.keys,objectReduceAsync=async function(e,r,t,n,o){const c=n.length;for(;++o<c;){const c=n[o];t=r(t,e[c],c,e),isPromise(t)&&(t=await t)}return t},objectReduce=function(e,r,t){const n=objectKeys(e),o=n.length;let c=-1;for(void 0===t&&(t=e[n[++c]]);++c<o;){const o=n[c];if(t=r(t,e[o],o,e),isPromise(t))return t.then((s=objectReduceAsync,u=r,a=__,l=n,y=c,(i=e)==__?curry5ResolveArg0(s,u,a,l,y):u==__?curry5ResolveArg1(s,i,a,l,y):a==__?curry5ResolveArg2(s,i,u,l,y):l==__?curry5ResolveArg3(s,i,u,a,y):curry5ResolveArg4(s,i,u,a,l)))}var s,i,u,a,l,y;return t},mapReduceAsync=async function(e,r,t,n){for(const[o,c]of n)t=r(t,c,o,e),isPromise(t)&&(t=await t);return t},mapReduce=function(e,r,t){const n=e.entries();if(void 0===t){const e=n.next();if(e.done)return t;t=e.value[1]}for(const[o,c]of n)if(t=r(t,c,o,e),isPromise(t))return t.then(curry4(mapReduceAsync,e,r,__,n));return t},reducerConcat=(e,r)=>function(t,n){const o=e(t,n);return isPromise(o)?o.then(curry2(r,__,n)):r(o,n)},genericReduce=function(e,r,t){return isArray(e)?arrayReduce(e,r,t):null==e?void 0===t?curry2(r,e,__):r(t,e):e.constructor==Map?mapReduce(e,r,t):"function"==typeof e[symbolIterator]?iteratorReduce(e[symbolIterator](),r,t):"function"==typeof e[symbolAsyncIterator]?asyncIteratorReduce(e[symbolAsyncIterator](),r,t):"function"==typeof e.reduce?e.reduce(r,t):"function"==typeof e.chain?e.chain(curry2(r,t,__)):"function"==typeof e.flatMap?e.flatMap(curry2(r,t,__)):e.constructor==Object?objectReduce(e,r,t):void 0===t?curry2(r,e,__):r(t,e)},FlatMappingIterator=function(e,r){let t=[],n=0;return{[symbolIterator](){return this},next(){if(n<t.length){const e=t[n];return n+=1,{value:e,done:!1}}const o=e.next();if(o.done)return o;const c=genericReduce(r(o.value),arrayPush,[]);return c.length>1&&(t=c,n=1),{value:c[0],done:!1}}}},promiseRace=Promise.race.bind(Promise),sleep=e=>new Promise((r=>{setTimeout(r,e)})),FlatMappingAsyncIterator=function(e,r){const t=[],n=new Set;return{isAsyncIteratorDone:!1,[symbolAsyncIterator](){return this},toString:()=>"[object FlatMappingAsyncIterator]",async next(){for(;!this.isAsyncIteratorDone||t.length>0||n.size>0;){if(!this.isAsyncIteratorDone){const{value:o,done:c}=await e.next();if(c)this.isAsyncIteratorDone=c;else{const e=r(o);if(isPromise(e)){const r=e.then(curry3(genericReduce,__,arrayPush,t)).then((()=>n.delete(r)));n.add(r)}else{const r=genericReduce(e,arrayPush,t);if(isPromise(r)){const e=r.then((()=>n.delete(e)));n.add(e)}}}}if(t.length>0)return{value:t.shift(),done:!1};n.size>0&&await promiseRace([sleep(1e3),...n])}return{value:void 0,done:!0}}}},arrayMap=function(e,r){const t=e.length,n=Array(t);let o=-1,c=!1;for(;++o<t;){const t=r(e[o],o,e);isPromise(t)&&(c=!0),n[o]=t}return c?promiseAll(n):n},arrayFlatMap=function(e,r){const t=arrayMap(e,r);return isPromise(t)?t.then(arrayFlatten):arrayFlatten(t)},promiseObjectAllExecutor=e=>function(r){const t={};let n=0;for(const o in e){const c=e[o];isPromise(c)?(n+=1,c.then((e=>function(o){t[e]=o,n-=1,0==n&&r(t)})(o))):t[o]=c}0==n&&r(t)},promiseObjectAll=e=>new Promise(promiseObjectAllExecutor(e)),objectMap=function(e,r){const t={};let n=!1;for(const o in e){const c=r(e[o],o,e);isPromise(c)&&(n=!0),t[o]=c}return n?promiseObjectAll(t):t},objectFlatMap=function(e,r){const t=objectMap(e,r);return isPromise(t)?t.then(objectFlatten):objectFlatten(t)},setMap=function(e,r){const t=new Set,n=[];for(const o of e){const c=r(o,o,e);isPromise(c)?n.push(c.then(curry3(callPropUnary,t,"add",__))):t.add(c)}return 0==n.length?t:promiseAll(n).then(always(t))},setFlatMap=function(e,r){const t=setMap(e,r);return isPromise(t)?t.then(setFlatten):setFlatten(t)},funcConcat=(e,r)=>function(...t){const n=e(...t);return isPromise(n)?n.then(r):r(n)},arrayJoin=(e,r)=>e.join(r),arrayFlattenToString=funcConcat(arrayFlatten,curry2(arrayJoin,__,"")),stringFlatMap=function(e,r){const t=arrayMap(e,r);return isPromise(t)?t.then(arrayFlattenToString):arrayFlattenToString(t)},_flatMap=function(e,r){if(isArray(e))return arrayFlatMap(e,r);if(null==e)return r(e);if("function"==typeof e.then)return e.then(r);if("function"==typeof e.next)return symbolIterator in e?FlatMappingIterator(e,r):FlatMappingAsyncIterator(e,r);if("function"==typeof e.chain)return e.chain(r);if("function"==typeof e.flatMap)return e.flatMap(r);const t=e.constructor;return t==Object?objectFlatMap(e,r):t==Set?setFlatMap(e,r):"string"==typeof e||t==String?stringFlatMap(e,r):r(e)},flatMap=(...e)=>{const r=e.pop();if(0==e.length)return curry2(_flatMap,__,r);const t=e[0];return isPromise(t)?t.then(curry2(_flatMap,__,r)):_flatMap(e[0],r)},flatten=function(e){return isArray(e)?arrayFlatten(e):null==e?e:e.constructor==Set?setFlatten(e):e.constructor==Object?objectFlatten(e):flatMap(e,identity)};export default flatten;
|
|
7
|
+
const isArray=Array.isArray,__=Symbol.for("placeholder"),arrayPush=function(r,e){return r.push(e),r},always=r=>function(){return r},curry2ResolveArg0=(r,e)=>function(t){return r(t,e)},curry2ResolveArg1=(r,e)=>function(t){return r(e,t)},curry2=function(r,e,t){return e==__?curry2ResolveArg0(r,t):curry2ResolveArg1(r,e)},getArg1=(r,e)=>e,identity=r=>r,isPromise=r=>null!=r&&"function"==typeof r.then,promiseAll=Promise.all.bind(Promise),funcConcatSync=(r,e)=>function(...t){return e(r(...t))},asyncIteratorForEach=async function(r,e){const t=[];for await(const n of r){const r=e(n);isPromise(r)&&t.push(r)}return 0==t.length?r:promiseAll(t).then(always(r))},symbolIterator=Symbol.iterator,symbolAsyncIterator=Symbol.asyncIterator,arrayFlatten=function(r){const e=r.length,t=[],n=[];let o=-1;for(;++o<e;){const e=r[o];if(isArray(e)){const r=e.length;let t=-1;for(;++t<r;)n.push(e[t])}else if(null==e)n.push(e);else if("function"==typeof e.then)t.push(e.then(curry2(arrayPush,n,__)));else if("function"==typeof e[symbolIterator])for(const r of e)n.push(r);else if("function"==typeof e[symbolAsyncIterator])t.push(asyncIteratorForEach(e[symbolAsyncIterator](),curry2(arrayPush,n,__)));else if("function"==typeof e.chain){const r=e.chain(identity);isPromise(r)?t.push(r.then(curry2(arrayPush,n,__))):n.push(r)}else if("function"==typeof e.flatMap){const r=e.flatMap(identity);isPromise(r)?t.push(r.then(curry2(arrayPush,n,__))):n.push(r)}else if("function"==typeof e.reduce){const r=e.reduce(funcConcatSync(getArg1,curry2(arrayPush,n,__)),null);isPromise(r)&&t.push(r)}else if(e.constructor==Object)for(const r in e)n.push(e[r]);else n.push(e)}return 0==t.length?n:promiseAll(t).then(always(n))},curry3ResolveArg0=(r,e,t)=>function(n){return r(n,e,t)},curry3ResolveArg1=(r,e,t)=>function(n){return r(e,n,t)},curry3ResolveArg2=(r,e,t)=>function(n){return r(e,t,n)},curry3=function(r,e,t,n){return e==__?curry3ResolveArg0(r,t,n):t==__?curry3ResolveArg1(r,e,n):curry3ResolveArg2(r,e,t)},callPropUnary=(r,e,t)=>r[e](t),setFlatten=function(r){r.size;const e=[],t=new Set,n=(r,e)=>t.add(e),o=curry3(callPropUnary,t,"add",__);for(const c of r)if(isArray(c)){const r=c.length;let e=-1;for(;++e<r;)t.add(c[e])}else if(null==c)t.add(c);else if("function"==typeof c[symbolIterator])for(const r of c)t.add(r);else if("function"==typeof c[symbolAsyncIterator])e.push(asyncIteratorForEach(c[symbolAsyncIterator](),o));else if("function"==typeof c.chain){const r=c.chain(identity);isPromise(r)?e.push(r.then(o)):t.add(r)}else if("function"==typeof c.flatMap){const r=c.flatMap(identity);isPromise(r)?e.push(r.then(o)):t.add(r)}else if("function"==typeof c.reduce){const r=c.reduce(n,null);isPromise(r)&&e.push(r)}else if(c.constructor==Object)for(const r in c)t.add(c[r]);else t.add(c);return 0==e.length?t:promiseAll(e).then((()=>t))},objectAssign=Object.assign,objectFlatten=function(r){const e=[],t={},n=curry2(objectAssign,t,__),o=funcConcatSync(getArg1,n);for(const c in r){const s=r[c];if(null!=s)if("function"==typeof s[symbolIterator])for(const r of s)objectAssign(t,r);else if("function"==typeof s[symbolAsyncIterator])e.push(asyncIteratorForEach(s[symbolAsyncIterator](),n));else if("function"==typeof s.chain){const r=s.chain(identity);isPromise(r)?e.push(r.then(n)):objectAssign(t,r)}else if("function"==typeof s.flatMap){const r=s.flatMap(identity);isPromise(r)?e.push(r.then(n)):n(r)}else if("function"==typeof s.reduce){const r=s.reduce(o,null);isPromise(r)&&e.push(r)}else objectAssign(t,s)}return 0==e.length?t:promiseAll(e).then((()=>t))},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,t){let n=r.next();if(n.done)return t;for(;!n.done;)t=e(t,n.value),isPromise(t)&&(t=await t),n=r.next();return t},iteratorReduce=function(r,e,t){let n=r.next();if(n.done)return t;for(void 0===t&&(t=n.value,n=r.next());!n.done;){if(t=e(t,n.value),isPromise(t))return t.then(curry3(iteratorReduceAsync,r,e,__));n=r.next()}return t},asyncIteratorReduce=async function(r,e,t){let n=await r.next();if(n.done)return t;for(void 0===t&&(t=n.value,n=await r.next());!n.done;)t=await e(t,n.value),n=await r.next();return t},curryArgs3ResolveArgs0=(r,e,t)=>function(...n){return r(n,e,t)},curryArgs3ResolveArgs1=(r,e,t)=>function(...n){return r(e,n,t)},curryArgs3ResolveArgs2=(r,e,t)=>function(...n){return r(e,t,n)},curryArgs3=function(r,e,t,n){return e==__?curryArgs3ResolveArgs0(r,t,n):t==__?curryArgs3ResolveArgs1(r,e,n):curryArgs3ResolveArgs2(r,e,t)},curry4ResolveArg0=(r,e,t,n)=>function(o){return r(o,e,t,n)},curry4ResolveArg1=(r,e,t,n)=>function(o){return r(e,o,t,n)},curry4ResolveArg2=(r,e,t,n)=>function(o){return r(e,t,o,n)},curry4ResolveArg3=(r,e,t,n)=>function(o){return r(e,t,n,o)},curry4=function(r,e,t,n,o){return e==__?curry4ResolveArg0(r,t,n,o):t==__?curry4ResolveArg1(r,e,n,o):n==__?curry4ResolveArg2(r,e,t,o):curry4ResolveArg3(r,e,t,n)},arrayReduceAsync=async function(r,e,t,n){const o=r.length;for(;++n<o;)t=e(t,r[n],n,r),isPromise(t)&&(t=await t);return t},arrayReduce=function(r,e,t){const n=r.length;let o=-1;for(void 0===t&&(t=r[++o]);++o<n;)if(t=e(t,r[o],o,r),isPromise(t))return t.then(curry4(arrayReduceAsync,r,e,__,o));return t},curry5ResolveArg0=(r,e,t,n,o)=>function(c){return r(c,e,t,n,o)},curry5ResolveArg1=(r,e,t,n,o)=>function(c){return r(e,c,t,n,o)},curry5ResolveArg2=(r,e,t,n,o)=>function(c){return r(e,t,c,n,o)},curry5ResolveArg3=(r,e,t,n,o)=>function(c){return r(e,t,n,c,o)},curry5ResolveArg4=(r,e,t,n,o)=>function(c){return r(e,t,n,o,c)},curry5=function(r,e,t,n,o,c){return e==__?curry5ResolveArg0(r,t,n,o,c):t==__?curry5ResolveArg1(r,e,n,o,c):n==__?curry5ResolveArg2(r,e,t,o,c):o==__?curry5ResolveArg3(r,e,t,n,c):curry5ResolveArg4(r,e,t,n,o)},objectKeys=Object.keys,objectReduceAsync=async function(r,e,t,n,o){const c=n.length;for(;++o<c;){const c=n[o];t=e(t,r[c],c,r),isPromise(t)&&(t=await t)}return t},objectReduce=function(r,e,t){const n=objectKeys(r),o=n.length;let c=-1;for(void 0===t&&(t=r[n[++c]]);++c<o;){const o=n[c];if(t=e(t,r[o],o,r),isPromise(t))return t.then((s=objectReduceAsync,u=e,a=__,l=n,y=c,(i=r)==__?curry5ResolveArg0(s,u,a,l,y):u==__?curry5ResolveArg1(s,i,a,l,y):a==__?curry5ResolveArg2(s,i,u,l,y):l==__?curry5ResolveArg3(s,i,u,a,y):curry5ResolveArg4(s,i,u,a,l)))}var s,i,u,a,l,y;return t},mapReduceAsync=async function(r,e,t,n){for(const[o,c]of n)t=e(t,c,o,r),isPromise(t)&&(t=await t);return t},mapReduce=function(r,e,t){const n=r.entries();if(void 0===t){const r=n.next();if(r.done)return t;t=r.value[1]}for(const[o,c]of n)if(t=e(t,c,o,r),isPromise(t))return t.then(curry4(mapReduceAsync,r,e,__,n));return t},reducerConcat=(r,e)=>function(t,n){const o=r(t,n);return isPromise(o)?o.then(curry2(e,__,n)):e(o,n)},genericReduce=function(r,e,t){return isArray(r)?arrayReduce(r,e,t):null==r?void 0===t?curry2(e,r,__):e(t,r):r.constructor==Map?mapReduce(r,e,t):"function"==typeof r[symbolIterator]?iteratorReduce(r[symbolIterator](),e,t):"function"==typeof r[symbolAsyncIterator]?asyncIteratorReduce(r[symbolAsyncIterator](),e,t):"function"==typeof r.reduce?r.reduce(e,t):"function"==typeof r.chain?r.chain(curry2(e,t,__)):"function"==typeof r.flatMap?r.flatMap(curry2(e,t,__)):r.constructor==Object?objectReduce(r,e,t):void 0===t?curry2(e,r,__):e(t,r)},FlatMappingIterator=function(r,e){let t=[],n=0;return{[symbolIterator](){return this},next(){if(n<t.length){const r=t[n];return n+=1,{value:r,done:!1}}const o=r.next();if(o.done)return o;const c=genericReduce(e(o.value),arrayPush,[]);return c.length>1&&(t=c,n=1),{value:c[0],done:!1}}}},promiseRace=Promise.race.bind(Promise),sleep=r=>new Promise((e=>{setTimeout(e,r)})),FlatMappingAsyncIterator=function(r,e){const t=[],n=new Set;return{isAsyncIteratorDone:!1,[symbolAsyncIterator](){return this},toString:()=>"[object FlatMappingAsyncIterator]",async next(){for(;!this.isAsyncIteratorDone||t.length>0||n.size>0;){if(!this.isAsyncIteratorDone){const{value:o,done:c}=await r.next();if(c)this.isAsyncIteratorDone=c;else{const r=e(o);if(isPromise(r)){const e=r.then(curry3(genericReduce,__,arrayPush,t)).then((()=>n.delete(e)));n.add(e)}else{const e=genericReduce(r,arrayPush,t);if(isPromise(e)){const r=e.then((()=>n.delete(r)));n.add(r)}}}}if(t.length>0)return{value:t.shift(),done:!1};n.size>0&&await promiseRace([sleep(1e3),...n])}return{value:void 0,done:!0}}}},arrayMap=function(r,e){const t=r.length,n=Array(t);let o=-1,c=!1;for(;++o<t;){const t=e(r[o],o,r);isPromise(t)&&(c=!0),n[o]=t}return c?promiseAll(n):n},arrayFlatMap=function(r,e){const t=arrayMap(r,e);return isPromise(t)?t.then(arrayFlatten):arrayFlatten(t)},promiseObjectAllExecutor=r=>function(e){const t={};let n=0;for(const o in r){const c=r[o];isPromise(c)?(n+=1,c.then((r=>function(o){t[r]=o,n-=1,0==n&&e(t)})(o))):t[o]=c}0==n&&e(t)},promiseObjectAll=r=>new Promise(promiseObjectAllExecutor(r)),objectMap=function(r,e){const t={};let n=!1;for(const o in r){const c=e(r[o],o,r);isPromise(c)&&(n=!0),t[o]=c}return n?promiseObjectAll(t):t},objectFlatMap=function(r,e){const t=objectMap(r,e);return isPromise(t)?t.then(objectFlatten):objectFlatten(t)},setMap=function(r,e){const t=new Set,n=[];for(const o of r){const c=e(o,o,r);isPromise(c)?n.push(c.then(curry3(callPropUnary,t,"add",__))):t.add(c)}return 0==n.length?t:promiseAll(n).then(always(t))},setFlatMap=function(r,e){const t=setMap(r,e);return isPromise(t)?t.then(setFlatten):setFlatten(t)},funcConcat=(r,e)=>function(...t){const n=r(...t);return isPromise(n)?n.then(e):e(n)},arrayJoin=(r,e)=>r.join(e),arrayFlattenToString=funcConcat(arrayFlatten,curry2(arrayJoin,__,"")),stringFlatMap=function(r,e){const t=arrayMap(r,e);return isPromise(t)?t.then(arrayFlattenToString):arrayFlattenToString(t)},_flatMap=function(r,e){if(isArray(r))return arrayFlatMap(r,e);if(null==r)return e(r);if("function"==typeof r.then)return r.then(e);if("function"==typeof r.next)return symbolIterator in r?FlatMappingIterator(r,e):FlatMappingAsyncIterator(r,e);if("function"==typeof r.chain)return r.chain(e);if("function"==typeof r.flatMap)return r.flatMap(e);const t=r.constructor;return t==Object?objectFlatMap(r,e):t==Set?setFlatMap(r,e):"string"==typeof r||t==String?stringFlatMap(r,e):e(r)},flatMap=(r,e)=>"function"==typeof r?curry2(_flatMap,__,r):isPromise(r)?r.then(curry2(_flatMap,__,e)):_flatMap(r,e),flatten=function(r){return isArray(r)?arrayFlatten(r):null==r?r:r.constructor==Set?setFlatten(r):r.constructor==Object?objectFlatten(r):(t=identity,"function"==typeof(e=r)?curry2(_flatMap,__,e):isPromise(e)?e.then(curry2(_flatMap,__,t)):_flatMap(e,t));var e,t};export default flatten;
|
package/dist/x/flatten.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.
|
|
2
|
+
* rubico v2.4.1
|
|
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.
|
|
@@ -815,15 +815,13 @@ const _flatMap = function (value, flatMapper) {
|
|
|
815
815
|
return flatMapper(value)
|
|
816
816
|
}
|
|
817
817
|
|
|
818
|
-
const flatMap = (
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
return curry2(_flatMap, __, flatMapper)
|
|
818
|
+
const flatMap = (arg0, arg1) => {
|
|
819
|
+
if (typeof arg0 == 'function') {
|
|
820
|
+
return curry2(_flatMap, __, arg0)
|
|
822
821
|
}
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
: _flatMap(args[0], flatMapper)
|
|
822
|
+
return isPromise(arg0)
|
|
823
|
+
? arg0.then(curry2(_flatMap, __, arg1))
|
|
824
|
+
: _flatMap(arg0, arg1)
|
|
827
825
|
}
|
|
828
826
|
|
|
829
827
|
const flatten = function (value) {
|
package/dist/x/flatten.min.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.
|
|
2
|
+
* rubico v2.4.1
|
|
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.flatten=t}("object"==typeof globalThis?globalThis:this,function(){"use strict";const n=Array.isArray,t=Symbol.for("placeholder"),e=function(n,t){return n.push(t),n},o=n=>function(){return n},r=function(n,e,o){return e==t?((n,t)=>function(e){return n(e,t)})(n,o):((n,t)=>function(e){return n(t,e)})(n,e)},u=(n,t)=>t,c=n=>n,f=n=>null!=n&&"function"==typeof n.then,i=Promise.all.bind(Promise),s=(n,t)=>function(...e){return t(n(...e))},l=async function(n,t){const e=[];for await(const o of n){const n=t(o);f(n)&&e.push(n)}return 0==e.length?n:i(e).then(o(n))},a=Symbol.iterator,h=Symbol.asyncIterator,p=function(p){const d=p.length,y=[],g=[];let v=-1;for(;++v<d;){const o=p[v];if(n(o)){const n=o.length;let t=-1;for(;++t<n;)g.push(o[t])}else if(null==o)g.push(o);else if("function"==typeof o.then)y.push(o.then(r(e,g,t)));else if("function"==typeof o[a])for(const n of o)g.push(n);else if("function"==typeof o[h])y.push(l(o[h](),r(e,g,t)));else if("function"==typeof o.chain){const n=o.chain(c);f(n)?y.push(n.then(r(e,g,t))):g.push(n)}else if("function"==typeof o.flatMap){const n=o.flatMap(c);f(n)?y.push(n.then(r(e,g,t))):g.push(n)}else if("function"==typeof o.reduce){const n=o.reduce(s(u,r(e,g,t)),null);f(n)&&y.push(n)}else if(o.constructor==Object)for(const n in o)g.push(o[n]);else g.push(o)}return 0==y.length?g:i(y).then(o(g))},d=function(n,e,o,r){return e==t?((n,t,e)=>function(o){return n(o,t,e)})(n,o,r):o==t?((n,t,e)=>function(o){return n(t,o,e)})(n,e,r):((n,t,e)=>function(o){return n(t,e,o)})(n,e,o)},y=(n,t,e)=>n[t](e),g=function(e){e.size;const o=[],r=new Set,u=(n,t)=>r.add(t),s=d(y,r,"add",t);for(const t of e)if(n(t)){const n=t.length;let e=-1;for(;++e<n;)r.add(t[e])}else if(null==t)r.add(t);else if("function"==typeof t[a])for(const n of t)r.add(n);else if("function"==typeof t[h])o.push(l(t[h](),s));else if("function"==typeof t.chain){const n=t.chain(c);f(n)?o.push(n.then(s)):r.add(n)}else if("function"==typeof t.flatMap){const n=t.flatMap(c);f(n)?o.push(n.then(s)):r.add(n)}else if("function"==typeof t.reduce){const n=t.reduce(u,null);f(n)&&o.push(n)}else if(t.constructor==Object)for(const n in t)r.add(t[n]);else r.add(t);return 0==o.length?r:i(o).then((()=>r))},v=Object.assign,b=function(n){const e=[],o={},p=r(v,o,t),d=s(u,p);for(const t in n){const r=n[t];if(null!=r)if("function"==typeof r[a])for(const n of r)v(o,n);else if("function"==typeof r[h])e.push(l(r[h](),p));else if("function"==typeof r.chain){const n=r.chain(c);f(n)?e.push(n.then(p)):v(o,n)}else if("function"==typeof r.flatMap){const n=r.flatMap(c);f(n)?e.push(n.then(p)):p(n)}else if("function"==typeof r.reduce){const n=r.reduce(d,null);f(n)&&e.push(n)}else v(o,r)}return 0==e.length?o:i(e).then((()=>o))},w=(Object.values,Object.prototype.toString,async function(n,t,e){let o=n.next();if(o.done)return e;for(;!o.done;)e=t(e,o.value),f(e)&&(e=await e),o=n.next();return e}),x=function(n,e,o,r,u){return e==t?((n,t,e,o)=>function(r){return n(r,t,e,o)})(n,o,r,u):o==t?((n,t,e,o)=>function(r){return n(t,r,e,o)})(n,e,r,u):r==t?((n,t,e,o)=>function(r){return n(t,e,r,o)})(n,e,o,u):((n,t,e,o)=>function(r){return n(t,e,o,r)})(n,e,o,r)},j=async function(n,t,e,o){const r=n.length;for(;++o<r;)e=t(e,n[o],o,n),f(e)&&(e=await e);return e},m=Object.keys,M=async function(n,t,e,o,r){const u=o.length;for(;++r<u;){const u=o[r];e=t(e,n[u],u,n),f(e)&&(e=await e)}return e},S=async function(n,t,e,o){for(const[r,u]of o)e=t(e,u,r,n),f(e)&&(e=await e);return e},O=function(e,o,u){return n(e)?function(n,e,o){const r=n.length;let u=-1;for(void 0===o&&(o=n[++u]);++u<r;)if(o=e(o,n[u],u,n),f(o))return o.then(x(j,n,e,t,u));return o}(e,o,u):null==e?void 0===u?r(o,e,t):o(u,e):e.constructor==Map?function(n,e,o){const r=n.entries();if(void 0===o){const n=r.next();if(n.done)return o;o=n.value[1]}for(const[u,c]of r)if(o=e(o,c,u,n),f(o))return o.then(x(S,n,e,t,r));return o}(e,o,u):"function"==typeof e[a]?function(n,e,o){let r=n.next();if(r.done)return o;for(void 0===o&&(o=r.value,r=n.next());!r.done;){if(o=e(o,r.value),f(o))return o.then(d(w,n,e,t));r=n.next()}return o}(e[a](),o,u):"function"==typeof e[h]?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}(e[h](),o,u):"function"==typeof e.reduce?e.reduce(o,u):"function"==typeof e.chain?e.chain(r(o,u,t)):"function"==typeof e.flatMap?e.flatMap(r(o,u,t)):e.constructor==Object?function(n,e,o){const r=m(n),u=r.length;let c=-1;for(void 0===o&&(o=n[r[++c]]);++c<u;){const u=r[c];if(o=e(o,n[u],u,n),f(o))return o.then((i=M,l=e,a=t,h=r,p=c,(s=n)==t?((n,t,e,o,r)=>function(u){return n(u,t,e,o,r)})(i,l,a,h,p):l==t?((n,t,e,o,r)=>function(u){return n(t,u,e,o,r)})(i,s,a,h,p):a==t?((n,t,e,o,r)=>function(u){return n(t,e,u,o,r)})(i,s,l,h,p):h==t?((n,t,e,o,r)=>function(u){return n(t,e,o,u,r)})(i,s,l,a,p):((n,t,e,o,r)=>function(u){return n(t,e,o,r,u)})(i,s,l,a,h)))}var i,s,l,a,h,p;return o}(e,o,u):void 0===u?r(o,e,t):o(u,e)},A=Promise.race.bind(Promise),I=n=>new Promise((t=>{setTimeout(t,n)})),P=function(n,t){const e=n.length,o=Array(e);let r=-1,u=!1;for(;++r<e;){const e=t(n[r],r,n);f(e)&&(u=!0),o[r]=e}return u?i(o):o},D=n=>new Promise((n=>function(t){const e={};let o=0;for(const r in n){const u=n[r];f(u)?(o+=1,u.then((n=>function(r){e[n]=r,o-=1,0==o&&t(e)})(r))):e[r]=u}0==o&&t(e)})(n)),z=function(n,t){const e=function(n,t){const e={};let o=!1;for(const r in n){const u=t(n[r],r,n);f(u)&&(o=!0),e[r]=u}return o?D(e):e}(n,t);return f(e)?e.then(b):b(e)},T=function(n,e){const r=function(n,e){const r=new Set,u=[];for(const o of n){const c=e(o,o,n);f(c)?u.push(c.then(d(y,r,"add",t))):r.add(c)}return 0==u.length?r:i(u).then(o(r))}(n,e);return f(r)?r.then(g):g(r)},k=(F=p,q=r(((n,t)=>n.join(t)),t,""),function(...n){const t=F(...n);return f(t)?t.then(q):q(t)});var F,q;const B=function(o,r){if(n(o))return function(n,t){const e=P(n,t);return f(e)?e.then(p):p(e)}(o,r);if(null==o)return r(o);if("function"==typeof o.then)return o.then(r);if("function"==typeof o.next)return a in o?function(n,t){let o=[],r=0;return{[a](){return this},next(){if(r<o.length){const n=o[r];return r+=1,{value:n,done:!1}}const u=n.next();if(u.done)return u;const c=O(t(u.value),e,[]);return c.length>1&&(o=c,r=1),{value:c[0],done:!1}}}}(o,r):function(n,o){const r=[],u=new Set;return{isAsyncIteratorDone:!1,[h](){return this},toString:()=>"[object FlatMappingAsyncIterator]",async next(){for(;!this.isAsyncIteratorDone||r.length>0||u.size>0;){if(!this.isAsyncIteratorDone){const{value:c,done:i}=await n.next();if(i)this.isAsyncIteratorDone=i;else{const n=o(c);if(f(n)){const o=n.then(d(O,t,e,r)).then((()=>u.delete(o)));u.add(o)}else{const t=O(n,e,r);if(f(t)){const n=t.then((()=>u.delete(n)));u.add(n)}}}}if(r.length>0)return{value:r.shift(),done:!1};u.size>0&&await A([I(1e3),...u])}return{value:void 0,done:!0}}}}(o,r);if("function"==typeof o.chain)return o.chain(r);if("function"==typeof o.flatMap)return o.flatMap(r);const u=o.constructor;return u==Object?z(o,r):u==Set?T(o,r):"string"==typeof o||u==String?function(n,t){const e=P(n,t);return f(e)?e.then(k):k(e)}(o,r):r(o)};return function(e){return n(e)?p(e):null==e?e:e.constructor==Set?g(e):e.constructor==Object?b(e):((
|
|
8
|
+
!function(n,t){"object"==typeof module?module.exports=t:"function"==typeof define?define((()=>t)):n.flatten=t}("object"==typeof globalThis?globalThis:this,function(){"use strict";const n=Array.isArray,t=Symbol.for("placeholder"),e=function(n,t){return n.push(t),n},o=n=>function(){return n},r=function(n,e,o){return e==t?((n,t)=>function(e){return n(e,t)})(n,o):((n,t)=>function(e){return n(t,e)})(n,e)},u=(n,t)=>t,c=n=>n,f=n=>null!=n&&"function"==typeof n.then,i=Promise.all.bind(Promise),s=(n,t)=>function(...e){return t(n(...e))},l=async function(n,t){const e=[];for await(const o of n){const n=t(o);f(n)&&e.push(n)}return 0==e.length?n:i(e).then(o(n))},a=Symbol.iterator,h=Symbol.asyncIterator,p=function(p){const d=p.length,y=[],g=[];let v=-1;for(;++v<d;){const o=p[v];if(n(o)){const n=o.length;let t=-1;for(;++t<n;)g.push(o[t])}else if(null==o)g.push(o);else if("function"==typeof o.then)y.push(o.then(r(e,g,t)));else if("function"==typeof o[a])for(const n of o)g.push(n);else if("function"==typeof o[h])y.push(l(o[h](),r(e,g,t)));else if("function"==typeof o.chain){const n=o.chain(c);f(n)?y.push(n.then(r(e,g,t))):g.push(n)}else if("function"==typeof o.flatMap){const n=o.flatMap(c);f(n)?y.push(n.then(r(e,g,t))):g.push(n)}else if("function"==typeof o.reduce){const n=o.reduce(s(u,r(e,g,t)),null);f(n)&&y.push(n)}else if(o.constructor==Object)for(const n in o)g.push(o[n]);else g.push(o)}return 0==y.length?g:i(y).then(o(g))},d=function(n,e,o,r){return e==t?((n,t,e)=>function(o){return n(o,t,e)})(n,o,r):o==t?((n,t,e)=>function(o){return n(t,o,e)})(n,e,r):((n,t,e)=>function(o){return n(t,e,o)})(n,e,o)},y=(n,t,e)=>n[t](e),g=function(e){e.size;const o=[],r=new Set,u=(n,t)=>r.add(t),s=d(y,r,"add",t);for(const t of e)if(n(t)){const n=t.length;let e=-1;for(;++e<n;)r.add(t[e])}else if(null==t)r.add(t);else if("function"==typeof t[a])for(const n of t)r.add(n);else if("function"==typeof t[h])o.push(l(t[h](),s));else if("function"==typeof t.chain){const n=t.chain(c);f(n)?o.push(n.then(s)):r.add(n)}else if("function"==typeof t.flatMap){const n=t.flatMap(c);f(n)?o.push(n.then(s)):r.add(n)}else if("function"==typeof t.reduce){const n=t.reduce(u,null);f(n)&&o.push(n)}else if(t.constructor==Object)for(const n in t)r.add(t[n]);else r.add(t);return 0==o.length?r:i(o).then((()=>r))},v=Object.assign,b=function(n){const e=[],o={},p=r(v,o,t),d=s(u,p);for(const t in n){const r=n[t];if(null!=r)if("function"==typeof r[a])for(const n of r)v(o,n);else if("function"==typeof r[h])e.push(l(r[h](),p));else if("function"==typeof r.chain){const n=r.chain(c);f(n)?e.push(n.then(p)):v(o,n)}else if("function"==typeof r.flatMap){const n=r.flatMap(c);f(n)?e.push(n.then(p)):p(n)}else if("function"==typeof r.reduce){const n=r.reduce(d,null);f(n)&&e.push(n)}else v(o,r)}return 0==e.length?o:i(e).then((()=>o))},w=(Object.values,Object.prototype.toString,async function(n,t,e){let o=n.next();if(o.done)return e;for(;!o.done;)e=t(e,o.value),f(e)&&(e=await e),o=n.next();return e}),x=function(n,e,o,r,u){return e==t?((n,t,e,o)=>function(r){return n(r,t,e,o)})(n,o,r,u):o==t?((n,t,e,o)=>function(r){return n(t,r,e,o)})(n,e,r,u):r==t?((n,t,e,o)=>function(r){return n(t,e,r,o)})(n,e,o,u):((n,t,e,o)=>function(r){return n(t,e,o,r)})(n,e,o,r)},j=async function(n,t,e,o){const r=n.length;for(;++o<r;)e=t(e,n[o],o,n),f(e)&&(e=await e);return e},m=Object.keys,M=async function(n,t,e,o,r){const u=o.length;for(;++r<u;){const u=o[r];e=t(e,n[u],u,n),f(e)&&(e=await e)}return e},S=async function(n,t,e,o){for(const[r,u]of o)e=t(e,u,r,n),f(e)&&(e=await e);return e},O=function(e,o,u){return n(e)?function(n,e,o){const r=n.length;let u=-1;for(void 0===o&&(o=n[++u]);++u<r;)if(o=e(o,n[u],u,n),f(o))return o.then(x(j,n,e,t,u));return o}(e,o,u):null==e?void 0===u?r(o,e,t):o(u,e):e.constructor==Map?function(n,e,o){const r=n.entries();if(void 0===o){const n=r.next();if(n.done)return o;o=n.value[1]}for(const[u,c]of r)if(o=e(o,c,u,n),f(o))return o.then(x(S,n,e,t,r));return o}(e,o,u):"function"==typeof e[a]?function(n,e,o){let r=n.next();if(r.done)return o;for(void 0===o&&(o=r.value,r=n.next());!r.done;){if(o=e(o,r.value),f(o))return o.then(d(w,n,e,t));r=n.next()}return o}(e[a](),o,u):"function"==typeof e[h]?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}(e[h](),o,u):"function"==typeof e.reduce?e.reduce(o,u):"function"==typeof e.chain?e.chain(r(o,u,t)):"function"==typeof e.flatMap?e.flatMap(r(o,u,t)):e.constructor==Object?function(n,e,o){const r=m(n),u=r.length;let c=-1;for(void 0===o&&(o=n[r[++c]]);++c<u;){const u=r[c];if(o=e(o,n[u],u,n),f(o))return o.then((i=M,l=e,a=t,h=r,p=c,(s=n)==t?((n,t,e,o,r)=>function(u){return n(u,t,e,o,r)})(i,l,a,h,p):l==t?((n,t,e,o,r)=>function(u){return n(t,u,e,o,r)})(i,s,a,h,p):a==t?((n,t,e,o,r)=>function(u){return n(t,e,u,o,r)})(i,s,l,h,p):h==t?((n,t,e,o,r)=>function(u){return n(t,e,o,u,r)})(i,s,l,a,p):((n,t,e,o,r)=>function(u){return n(t,e,o,r,u)})(i,s,l,a,h)))}var i,s,l,a,h,p;return o}(e,o,u):void 0===u?r(o,e,t):o(u,e)},A=Promise.race.bind(Promise),I=n=>new Promise((t=>{setTimeout(t,n)})),P=function(n,t){const e=n.length,o=Array(e);let r=-1,u=!1;for(;++r<e;){const e=t(n[r],r,n);f(e)&&(u=!0),o[r]=e}return u?i(o):o},D=n=>new Promise((n=>function(t){const e={};let o=0;for(const r in n){const u=n[r];f(u)?(o+=1,u.then((n=>function(r){e[n]=r,o-=1,0==o&&t(e)})(r))):e[r]=u}0==o&&t(e)})(n)),z=function(n,t){const e=function(n,t){const e={};let o=!1;for(const r in n){const u=t(n[r],r,n);f(u)&&(o=!0),e[r]=u}return o?D(e):e}(n,t);return f(e)?e.then(b):b(e)},T=function(n,e){const r=function(n,e){const r=new Set,u=[];for(const o of n){const c=e(o,o,n);f(c)?u.push(c.then(d(y,r,"add",t))):r.add(c)}return 0==u.length?r:i(u).then(o(r))}(n,e);return f(r)?r.then(g):g(r)},k=(F=p,q=r(((n,t)=>n.join(t)),t,""),function(...n){const t=F(...n);return f(t)?t.then(q):q(t)});var F,q;const B=function(o,r){if(n(o))return function(n,t){const e=P(n,t);return f(e)?e.then(p):p(e)}(o,r);if(null==o)return r(o);if("function"==typeof o.then)return o.then(r);if("function"==typeof o.next)return a in o?function(n,t){let o=[],r=0;return{[a](){return this},next(){if(r<o.length){const n=o[r];return r+=1,{value:n,done:!1}}const u=n.next();if(u.done)return u;const c=O(t(u.value),e,[]);return c.length>1&&(o=c,r=1),{value:c[0],done:!1}}}}(o,r):function(n,o){const r=[],u=new Set;return{isAsyncIteratorDone:!1,[h](){return this},toString:()=>"[object FlatMappingAsyncIterator]",async next(){for(;!this.isAsyncIteratorDone||r.length>0||u.size>0;){if(!this.isAsyncIteratorDone){const{value:c,done:i}=await n.next();if(i)this.isAsyncIteratorDone=i;else{const n=o(c);if(f(n)){const o=n.then(d(O,t,e,r)).then((()=>u.delete(o)));u.add(o)}else{const t=O(n,e,r);if(f(t)){const n=t.then((()=>u.delete(n)));u.add(n)}}}}if(r.length>0)return{value:r.shift(),done:!1};u.size>0&&await A([I(1e3),...u])}return{value:void 0,done:!0}}}}(o,r);if("function"==typeof o.chain)return o.chain(r);if("function"==typeof o.flatMap)return o.flatMap(r);const u=o.constructor;return u==Object?z(o,r):u==Set?T(o,r):"string"==typeof o||u==String?function(n,t){const e=P(n,t);return f(e)?e.then(k):k(e)}(o,r):r(o)};return function(e){return n(e)?p(e):null==e?e:e.constructor==Set?g(e):e.constructor==Object?b(e):(u=c,"function"==typeof(o=e)?r(B,t,o):f(o)?o.then(r(B,t,u)):B(o,u));var o,u}}());
|