rubico 2.11.0 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -20
- package/Transducer.js +87 -72
- package/__.js +3 -3
- package/_internal/functionArrayAllSeries.js +4 -3
- package/_internal/functionObjectAllSeries.js +65 -0
- package/_internal/genericTransform.js +0 -1
- package/all.js +36 -16
- package/always.js +4 -4
- package/and.js +34 -26
- package/assign.js +5 -5
- package/compose.js +7 -6
- package/curry.js +48 -28
- 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 +112 -8
- package/dist/all.es.min.js +2 -2
- package/dist/all.js +112 -8
- package/dist/all.min.js +2 -2
- package/dist/all.mjs +112 -8
- 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 +1 -1
- package/dist/every.es.min.js +1 -1
- package/dist/every.js +1 -1
- package/dist/every.min.js +1 -1
- package/dist/every.mjs +1 -1
- package/dist/filter.es.js +113 -19
- package/dist/filter.es.min.js +2 -2
- package/dist/filter.js +113 -19
- package/dist/filter.min.js +2 -2
- package/dist/filter.mjs +113 -19
- package/dist/flatMap.es.js +1 -1
- package/dist/flatMap.es.min.js +1 -1
- package/dist/flatMap.js +1 -1
- package/dist/flatMap.min.js +1 -1
- package/dist/flatMap.mjs +1 -1
- 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 +1 -1
- package/dist/map.es.min.js +1 -1
- package/dist/map.js +1 -1
- package/dist/map.min.js +1 -1
- package/dist/map.mjs +1 -1
- 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 +168 -79
- package/dist/rubico.es.min.js +2 -2
- package/dist/rubico.global.js +168 -79
- package/dist/rubico.global.min.js +2 -2
- package/dist/rubico.js +168 -79
- package/dist/rubico.min.js +2 -2
- package/dist/rubico.mjs +168 -79
- package/dist/set.es.js +1 -1
- package/dist/set.es.min.js +1 -1
- package/dist/set.js +1 -1
- package/dist/set.min.js +1 -1
- package/dist/set.mjs +1 -1
- package/dist/some.es.js +1 -1
- package/dist/some.es.min.js +1 -1
- package/dist/some.js +1 -1
- package/dist/some.min.js +1 -1
- package/dist/some.mjs +1 -1
- package/dist/switchCase.es.js +1 -1
- package/dist/switchCase.es.min.js +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 -3
- package/dist/transform.es.min.js +2 -2
- package/dist/transform.js +1 -3
- package/dist/transform.min.js +1 -1
- package/dist/transform.mjs +1 -3
- 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 +113 -19
- package/dist/x/filterOut.es.min.js +2 -2
- package/dist/x/filterOut.js +113 -19
- package/dist/x/filterOut.min.js +2 -2
- package/dist/x/filterOut.mjs +113 -19
- 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 +1 -1
- package/dist/x/flatten.es.min.js +1 -1
- package/dist/x/flatten.js +1 -1
- package/dist/x/flatten.min.js +1 -1
- package/dist/x/flatten.mjs +1 -1
- package/dist/x/groupBy.es.js +1 -1
- package/dist/x/groupBy.es.min.js +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 +1 -1
- package/dist/x/pluck.es.min.js +1 -1
- package/dist/x/pluck.js +1 -1
- package/dist/x/pluck.min.js +1 -1
- package/dist/x/pluck.mjs +1 -1
- 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/eq.js +29 -30
- package/es.js +168 -79
- package/every.js +16 -22
- package/filter.js +41 -78
- package/flatMap.js +16 -16
- package/forEach.js +14 -14
- package/get.js +3 -3
- package/gt.js +18 -25
- package/gte.js +22 -29
- package/index.js +168 -79
- package/lt.js +33 -31
- package/lte.js +24 -31
- package/map.js +43 -46
- package/not.js +12 -17
- package/or.js +34 -26
- package/package.json +1 -1
- package/pipe.js +6 -6
- package/reduce.js +62 -69
- package/some.js +13 -36
- package/switchCase.js +9 -9
- package/tap.js +7 -12
- package/thunkify.js +42 -12
- package/transform.js +62 -61
- package/tryCatch.js +4 -7
- package/_internal/add.js +0 -12
package/es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Rubico v2.
|
|
2
|
+
* Rubico v2.13.0
|
|
3
3
|
* https://rubico.land/
|
|
4
4
|
*
|
|
5
5
|
* © Richard Yufei Tong, King of Software
|
|
@@ -368,7 +368,8 @@ const functionArrayAllSeries = function (funcs, args) {
|
|
|
368
368
|
const funcsLength = funcs.length, result = []
|
|
369
369
|
let funcsIndex = -1
|
|
370
370
|
while (++funcsIndex < funcsLength) {
|
|
371
|
-
const
|
|
371
|
+
const f = funcs[funcsIndex]
|
|
372
|
+
const resultElement = typeof f == 'function' ? f(...args) : f
|
|
372
373
|
if (isPromise(resultElement)) {
|
|
373
374
|
return resultElement.then(funcConcat(
|
|
374
375
|
curry3(objectSet, result, funcsIndex, __),
|
|
@@ -379,6 +380,90 @@ const functionArrayAllSeries = function (funcs, args) {
|
|
|
379
380
|
return result
|
|
380
381
|
}
|
|
381
382
|
|
|
383
|
+
// argument resolver for curry5
|
|
384
|
+
const curry5ResolveArg0 = (
|
|
385
|
+
baseFunc, arg1, arg2, arg3, arg4,
|
|
386
|
+
) => function arg0Resolver(arg0) {
|
|
387
|
+
return baseFunc(arg0, arg1, arg2, arg3, arg4)
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// argument resolver for curry5
|
|
391
|
+
const curry5ResolveArg1 = (
|
|
392
|
+
baseFunc, arg0, arg2, arg3, arg4,
|
|
393
|
+
) => function arg1Resolver(arg1) {
|
|
394
|
+
return baseFunc(arg0, arg1, arg2, arg3, arg4)
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// argument resolver for curry5
|
|
398
|
+
const curry5ResolveArg2 = (
|
|
399
|
+
baseFunc, arg0, arg1, arg3, arg4,
|
|
400
|
+
) => function arg2Resolver(arg2) {
|
|
401
|
+
return baseFunc(arg0, arg1, arg2, arg3, arg4)
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// argument resolver for curry5
|
|
405
|
+
const curry5ResolveArg3 = (
|
|
406
|
+
baseFunc, arg0, arg1, arg2, arg4,
|
|
407
|
+
) => function arg3Resolver(arg3) {
|
|
408
|
+
return baseFunc(arg0, arg1, arg2, arg3, arg4)
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
// argument resolver for curry5
|
|
412
|
+
const curry5ResolveArg4 = (
|
|
413
|
+
baseFunc, arg0, arg1, arg2, arg3,
|
|
414
|
+
) => function arg3Resolver(arg4) {
|
|
415
|
+
return baseFunc(arg0, arg1, arg2, arg3, arg4)
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
const curry5 = function (baseFunc, arg0, arg1, arg2, arg3, arg4) {
|
|
419
|
+
if (arg0 == __) {
|
|
420
|
+
return curry5ResolveArg0(baseFunc, arg1, arg2, arg3, arg4)
|
|
421
|
+
}
|
|
422
|
+
if (arg1 == __) {
|
|
423
|
+
return curry5ResolveArg1(baseFunc, arg0, arg2, arg3, arg4)
|
|
424
|
+
}
|
|
425
|
+
if (arg2 == __) {
|
|
426
|
+
return curry5ResolveArg2(baseFunc, arg0, arg1, arg3, arg4)
|
|
427
|
+
}
|
|
428
|
+
if (arg3 == __) {
|
|
429
|
+
return curry5ResolveArg3(baseFunc, arg0, arg1, arg2, arg4)
|
|
430
|
+
}
|
|
431
|
+
return curry5ResolveArg4(baseFunc, arg0, arg1, arg2, arg3)
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
const asyncFunctionObjectAllSeries = async function (funcs, args, result, keys, keysIndex) {
|
|
435
|
+
const keysLength = keys.length
|
|
436
|
+
while (++keysIndex < keysLength) {
|
|
437
|
+
const key = keys[keysIndex]
|
|
438
|
+
const f = funcs[key]
|
|
439
|
+
let resultElement = typeof f == 'function' ? f(...args) : f
|
|
440
|
+
if (isPromise(resultElement)) {
|
|
441
|
+
resultElement = await resultElement
|
|
442
|
+
}
|
|
443
|
+
result[key] = resultElement
|
|
444
|
+
}
|
|
445
|
+
return result
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
const functionObjectAllSeries = function (funcs, args) {
|
|
449
|
+
const result = {}
|
|
450
|
+
const keys = Object.keys(funcs)
|
|
451
|
+
const keysLength = keys.length
|
|
452
|
+
let keysIndex = -1
|
|
453
|
+
while (++keysIndex < keysLength) {
|
|
454
|
+
const key = keys[keysIndex]
|
|
455
|
+
const f = funcs[key]
|
|
456
|
+
const resultElement = typeof f == 'function' ? f(...args) : f
|
|
457
|
+
if (isPromise(resultElement)) {
|
|
458
|
+
return resultElement.then(funcConcat(
|
|
459
|
+
curry3(objectSet, result, key, __),
|
|
460
|
+
curry5(asyncFunctionObjectAllSeries, funcs, args, __, keys, keysIndex)))
|
|
461
|
+
}
|
|
462
|
+
result[key] = resultElement
|
|
463
|
+
}
|
|
464
|
+
return result
|
|
465
|
+
}
|
|
466
|
+
|
|
382
467
|
const functionObjectAll = function (funcs, args) {
|
|
383
468
|
const result = {}, promises = []
|
|
384
469
|
for (const key in funcs) {
|
|
@@ -435,14 +520,33 @@ const all = function (...args) {
|
|
|
435
520
|
}
|
|
436
521
|
|
|
437
522
|
all.series = function allSeries(...args) {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
523
|
+
if (args.length == 1) {
|
|
524
|
+
const resolversOrValues = args[0]
|
|
525
|
+
if (isPromise(resolversOrValues)) {
|
|
526
|
+
return resolversOrValues.then(_allValues)
|
|
527
|
+
}
|
|
528
|
+
if (areAllValuesNonfunctions(resolversOrValues)) {
|
|
529
|
+
return _allValues(resolversOrValues)
|
|
530
|
+
}
|
|
531
|
+
return isArray(resolversOrValues)
|
|
532
|
+
? curryArgs2(functionArrayAllSeries, resolversOrValues, __)
|
|
533
|
+
: curryArgs2(functionObjectAllSeries, resolversOrValues, __)
|
|
441
534
|
}
|
|
442
|
-
|
|
443
|
-
|
|
535
|
+
|
|
536
|
+
const resolversOrValues = args[args.length - 1]
|
|
537
|
+
const argValues = args.slice(0, -1)
|
|
538
|
+
|
|
539
|
+
if (areAnyValuesPromises(argValues)) {
|
|
540
|
+
return isArray(resolversOrValues)
|
|
541
|
+
? promiseAll(argValues)
|
|
542
|
+
.then(curry2(functionArrayAllSeries, resolversOrValues, __))
|
|
543
|
+
: promiseAll(argValues)
|
|
544
|
+
.then(curry2(functionObjectAllSeries, resolversOrValues, __))
|
|
444
545
|
}
|
|
445
|
-
|
|
546
|
+
|
|
547
|
+
return isArray(resolversOrValues)
|
|
548
|
+
? functionArrayAllSeries(resolversOrValues, argValues)
|
|
549
|
+
: functionObjectAllSeries(resolversOrValues, argValues)
|
|
446
550
|
}
|
|
447
551
|
|
|
448
552
|
const objectAssign = Object.assign
|
|
@@ -1474,26 +1578,64 @@ const FilteringIterator = (iterator, predicate) => ({
|
|
|
1474
1578
|
},
|
|
1475
1579
|
})
|
|
1476
1580
|
|
|
1477
|
-
const FilteringAsyncIterator = (asyncIterator, predicate) =>
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1581
|
+
const FilteringAsyncIterator = (asyncIterator, predicate) => {
|
|
1582
|
+
const buffer = new LinkedList()
|
|
1583
|
+
|
|
1584
|
+
let index = -1
|
|
1585
|
+
let consumingAsyncIterator = false
|
|
1586
|
+
let isAsyncIteratorDone = false
|
|
1587
|
+
|
|
1588
|
+
return {
|
|
1589
|
+
[symbolAsyncIterator]() {
|
|
1590
|
+
return this
|
|
1591
|
+
},
|
|
1592
|
+
|
|
1593
|
+
// _consumeAsyncIterator() -> Promise<>
|
|
1594
|
+
async _consumeAsyncIterator() {
|
|
1595
|
+
for await (const item of asyncIterator) {
|
|
1596
|
+
index += 1
|
|
1597
|
+
const booleanResult = predicate(item)
|
|
1598
|
+
buffer.append([booleanResult, item])
|
|
1599
|
+
}
|
|
1600
|
+
isAsyncIteratorDone = true
|
|
1601
|
+
},
|
|
1602
|
+
|
|
1603
|
+
|
|
1604
|
+
async next() {
|
|
1605
|
+
if (!consumingAsyncIterator) {
|
|
1606
|
+
this._consumeAsyncIterator()
|
|
1607
|
+
consumingAsyncIterator = true
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
while (!isAsyncIteratorDone) {
|
|
1611
|
+
if (buffer.length > 0) {
|
|
1612
|
+
let [booleanResult, item] = buffer.popFirst()
|
|
1613
|
+
if (isPromise(booleanResult)) {
|
|
1614
|
+
booleanResult = await booleanResult
|
|
1615
|
+
}
|
|
1616
|
+
if (booleanResult) {
|
|
1617
|
+
return { value: item, done: false }
|
|
1618
|
+
}
|
|
1619
|
+
continue
|
|
1491
1620
|
}
|
|
1621
|
+
await sleep(10)
|
|
1492
1622
|
}
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1623
|
+
|
|
1624
|
+
while (buffer.length > 0) {
|
|
1625
|
+
let [booleanResult, item] = buffer.popFirst()
|
|
1626
|
+
if (isPromise(booleanResult)) {
|
|
1627
|
+
booleanResult = await booleanResult
|
|
1628
|
+
}
|
|
1629
|
+
if (booleanResult) {
|
|
1630
|
+
return { value: item, done: false }
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
return { value: undefined, done: true }
|
|
1635
|
+
},
|
|
1636
|
+
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1497
1639
|
|
|
1498
1640
|
const arrayExtendMap = function (
|
|
1499
1641
|
array, values, valuesMapper, valuesIndex,
|
|
@@ -1753,57 +1895,6 @@ const arrayReduce = function (array, reducer, result) {
|
|
|
1753
1895
|
return result
|
|
1754
1896
|
}
|
|
1755
1897
|
|
|
1756
|
-
// argument resolver for curry5
|
|
1757
|
-
const curry5ResolveArg0 = (
|
|
1758
|
-
baseFunc, arg1, arg2, arg3, arg4,
|
|
1759
|
-
) => function arg0Resolver(arg0) {
|
|
1760
|
-
return baseFunc(arg0, arg1, arg2, arg3, arg4)
|
|
1761
|
-
}
|
|
1762
|
-
|
|
1763
|
-
// argument resolver for curry5
|
|
1764
|
-
const curry5ResolveArg1 = (
|
|
1765
|
-
baseFunc, arg0, arg2, arg3, arg4,
|
|
1766
|
-
) => function arg1Resolver(arg1) {
|
|
1767
|
-
return baseFunc(arg0, arg1, arg2, arg3, arg4)
|
|
1768
|
-
}
|
|
1769
|
-
|
|
1770
|
-
// argument resolver for curry5
|
|
1771
|
-
const curry5ResolveArg2 = (
|
|
1772
|
-
baseFunc, arg0, arg1, arg3, arg4,
|
|
1773
|
-
) => function arg2Resolver(arg2) {
|
|
1774
|
-
return baseFunc(arg0, arg1, arg2, arg3, arg4)
|
|
1775
|
-
}
|
|
1776
|
-
|
|
1777
|
-
// argument resolver for curry5
|
|
1778
|
-
const curry5ResolveArg3 = (
|
|
1779
|
-
baseFunc, arg0, arg1, arg2, arg4,
|
|
1780
|
-
) => function arg3Resolver(arg3) {
|
|
1781
|
-
return baseFunc(arg0, arg1, arg2, arg3, arg4)
|
|
1782
|
-
}
|
|
1783
|
-
|
|
1784
|
-
// argument resolver for curry5
|
|
1785
|
-
const curry5ResolveArg4 = (
|
|
1786
|
-
baseFunc, arg0, arg1, arg2, arg3,
|
|
1787
|
-
) => function arg3Resolver(arg4) {
|
|
1788
|
-
return baseFunc(arg0, arg1, arg2, arg3, arg4)
|
|
1789
|
-
}
|
|
1790
|
-
|
|
1791
|
-
const curry5 = function (baseFunc, arg0, arg1, arg2, arg3, arg4) {
|
|
1792
|
-
if (arg0 == __) {
|
|
1793
|
-
return curry5ResolveArg0(baseFunc, arg1, arg2, arg3, arg4)
|
|
1794
|
-
}
|
|
1795
|
-
if (arg1 == __) {
|
|
1796
|
-
return curry5ResolveArg1(baseFunc, arg0, arg2, arg3, arg4)
|
|
1797
|
-
}
|
|
1798
|
-
if (arg2 == __) {
|
|
1799
|
-
return curry5ResolveArg2(baseFunc, arg0, arg1, arg3, arg4)
|
|
1800
|
-
}
|
|
1801
|
-
if (arg3 == __) {
|
|
1802
|
-
return curry5ResolveArg3(baseFunc, arg0, arg1, arg2, arg4)
|
|
1803
|
-
}
|
|
1804
|
-
return curry5ResolveArg4(baseFunc, arg0, arg1, arg2, arg3)
|
|
1805
|
-
}
|
|
1806
|
-
|
|
1807
1898
|
const objectKeys = Object.keys
|
|
1808
1899
|
|
|
1809
1900
|
const objectReduceAsync = async function (object, reducer, result, keys, index) {
|
|
@@ -1938,8 +2029,6 @@ const reduce = function (...args) {
|
|
|
1938
2029
|
|
|
1939
2030
|
const isBinary = ArrayBuffer.isView
|
|
1940
2031
|
|
|
1941
|
-
const add = (a, b) => a + b
|
|
1942
|
-
|
|
1943
2032
|
const _arrayExtend = function (array, values) {
|
|
1944
2033
|
const arrayLength = array.length,
|
|
1945
2034
|
valuesLength = values.length
|
package/every.js
CHANGED
|
@@ -42,27 +42,31 @@ const _every = function (collection, predicate) {
|
|
|
42
42
|
* @synopsis
|
|
43
43
|
* ```coffeescript [specscript]
|
|
44
44
|
* type Foldable = Array|Set|Map|Generator|AsyncGenerator|{ reduce: function }|Object
|
|
45
|
-
* type
|
|
45
|
+
* type Predicate = any=>Promise|boolean
|
|
46
46
|
*
|
|
47
|
-
* predicate
|
|
47
|
+
* predicate Predicate
|
|
48
48
|
*
|
|
49
49
|
* every(foldable Foldable, predicate) -> result Promise|boolean
|
|
50
50
|
* every(predicate)(foldable Foldable) -> result Promise|boolean
|
|
51
51
|
* ```
|
|
52
52
|
*
|
|
53
53
|
* @description
|
|
54
|
-
*
|
|
54
|
+
* Tests a predicate concurrently across all items of a foldable. Returns true if every item tests true by the predicate.
|
|
55
55
|
*
|
|
56
56
|
* ```javascript [playground]
|
|
57
57
|
* const isOdd = number => number % 2 == 1
|
|
58
58
|
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
59
|
+
* {
|
|
60
|
+
* const array = [1, 2, 3, 4, 5]
|
|
61
|
+
* const isEveryNumberOdd = every(array, isOdd)
|
|
62
|
+
* console.log(isEveryNumberOdd)
|
|
63
|
+
* }
|
|
62
64
|
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
65
|
+
* {
|
|
66
|
+
* const array = [1, 3, 5]
|
|
67
|
+
* const isEveryNumberOdd = every(array, isOdd)
|
|
68
|
+
* console.log(isEveryNumberOdd)
|
|
69
|
+
* }
|
|
66
70
|
* ```
|
|
67
71
|
*
|
|
68
72
|
* The following data types are considered to be foldables:
|
|
@@ -74,29 +78,19 @@ const _every = function (collection, predicate) {
|
|
|
74
78
|
* * `object with .reduce method`
|
|
75
79
|
* * `object`
|
|
76
80
|
*
|
|
77
|
-
* `every` works for async generators.
|
|
78
|
-
*
|
|
79
|
-
* ```javascript [playground]
|
|
80
|
-
* const asyncNumbers = async function* () {
|
|
81
|
-
* yield 1; yield 2; yield 3; yield 4; yield 5
|
|
82
|
-
* }
|
|
83
|
-
*
|
|
84
|
-
* every(asyncNumbers(), async number => number < 6).then(console.log) // true
|
|
85
|
-
* ```
|
|
86
|
-
*
|
|
87
81
|
* `every` supports a lazy interface for composability.
|
|
88
82
|
*
|
|
89
83
|
* ```javascript [playground]
|
|
90
84
|
* pipe([1, 2, 3], [
|
|
91
85
|
* every(number => number < 5),
|
|
92
|
-
* console.log,
|
|
86
|
+
* console.log,
|
|
93
87
|
* ])
|
|
94
88
|
* ```
|
|
95
89
|
*
|
|
96
|
-
*
|
|
90
|
+
* If the foldable is a promise, it is resolved for its value before further execution for the eager interface only.
|
|
97
91
|
*
|
|
98
92
|
* ```javascript [playground]
|
|
99
|
-
* every(Promise.resolve([1, 2, 3, 4, 5]), n => n < 6).then(console.log)
|
|
93
|
+
* every(Promise.resolve([1, 2, 3, 4, 5]), n => n < 6).then(console.log)
|
|
100
94
|
* ```
|
|
101
95
|
*
|
|
102
96
|
* See also:
|
package/filter.js
CHANGED
|
@@ -92,18 +92,28 @@ const _filter = function (value, predicate) {
|
|
|
92
92
|
* ```coffeescript [specscript]
|
|
93
93
|
* type Filterable = Array|Set|Map|Generator|AsyncGenerator|{ filter: function }|Object
|
|
94
94
|
*
|
|
95
|
-
* type
|
|
95
|
+
* type Predicate = (
|
|
96
96
|
* value any,
|
|
97
97
|
* indexOrKey number|string|any,
|
|
98
98
|
* filterable Filterable,
|
|
99
|
-
* )=>(booleanResult Promise|boolean)
|
|
99
|
+
* )=>(booleanResult Promise|boolean|any)
|
|
100
100
|
*
|
|
101
|
-
* filter(filterable Promise|Filterable, predicate
|
|
102
|
-
* filter(predicate
|
|
101
|
+
* filter(filterable Promise|Filterable, predicate Predicate) -> filteredFilterable Promise|Filterable
|
|
102
|
+
* filter(predicate Predicate)(filterable Filterable) -> filteredFilterable Promise|Filterable
|
|
103
103
|
* ```
|
|
104
104
|
*
|
|
105
105
|
* @description
|
|
106
|
-
* Filters out items from a filterable, returning a filterable of the same type. The order of the items of the filterable is preserved.
|
|
106
|
+
* Filters out items from a filterable, returning a filtered filterable of the same type. The order of the items of the filterable is preserved.
|
|
107
|
+
*
|
|
108
|
+
* ```javascript [playground]
|
|
109
|
+
* const isOdd = number => number % 2 == 1
|
|
110
|
+
*
|
|
111
|
+
* const array = [1, 2, 3, 4, 5]
|
|
112
|
+
*
|
|
113
|
+
* const filteredArray = filter(array, isOdd)
|
|
114
|
+
*
|
|
115
|
+
* console.log(filteredArray)
|
|
116
|
+
* ```
|
|
107
117
|
*
|
|
108
118
|
* The following data types are considered to be filterables:
|
|
109
119
|
* * `array`
|
|
@@ -114,11 +124,11 @@ const _filter = function (value, predicate) {
|
|
|
114
124
|
* * `object with .filter method`
|
|
115
125
|
* * `object`
|
|
116
126
|
*
|
|
117
|
-
* The filtering operation is defined by
|
|
127
|
+
* The filtering operation is defined by the predicate function, which determines whether a given item from the filterable should be included in the filtered filterable.
|
|
118
128
|
*
|
|
119
129
|
* ```javascript
|
|
120
130
|
* const predicate = function (item) {
|
|
121
|
-
* // booleanResult is the boolean result of the predicate
|
|
131
|
+
* // booleanResult is the boolean result of the predicate
|
|
122
132
|
* return booleanResult
|
|
123
133
|
* }
|
|
124
134
|
* ```
|
|
@@ -150,118 +160,71 @@ const _filter = function (value, predicate) {
|
|
|
150
160
|
* predicate(item any) -> booleanResult Promise|boolean|any
|
|
151
161
|
* ```
|
|
152
162
|
*
|
|
153
|
-
* If the filterable is an object with a `.filter` method, the predicate function signature is defined externally.
|
|
154
|
-
*
|
|
155
163
|
* If the filterable is a plain object:
|
|
156
164
|
* ```coffeescript [specscript]
|
|
157
165
|
* predicate(item any, key string, filterable Object) -> booleanResult Promise|boolean|any
|
|
158
166
|
* ```
|
|
159
167
|
*
|
|
160
|
-
*
|
|
161
|
-
* const isOdd = number => number % 2 == 1
|
|
162
|
-
*
|
|
163
|
-
* const array = [1, 2, 3, 4, 5]
|
|
164
|
-
*
|
|
165
|
-
* const filteredArray = filter(array, isOdd)
|
|
168
|
+
* If the filterable is an object with a `.filter` method, the predicate function signature is defined externally.
|
|
166
169
|
*
|
|
167
|
-
*
|
|
168
|
-
* ```
|
|
170
|
+
* If the filterable is a generator, the predicate function must be synchronous.
|
|
169
171
|
*
|
|
170
|
-
* If the predicate is asynchronous, it is executed concurrently.
|
|
172
|
+
* If the predicate function is asynchronous, it is executed concurrently.
|
|
171
173
|
*
|
|
172
174
|
* ```javascript [playground]
|
|
173
175
|
* const asyncIsOdd = async number => number % 2 == 1
|
|
174
176
|
*
|
|
175
177
|
* const array = [1, 2, 3, 4, 5]
|
|
176
178
|
*
|
|
177
|
-
* const
|
|
178
|
-
* promise.then(console.log) // [1, 3, 5]
|
|
179
|
-
* ```
|
|
180
|
-
*
|
|
181
|
-
* `filter` applies the predicate function to just the values of an object.
|
|
182
|
-
*
|
|
183
|
-
* ```javascript [playground]
|
|
184
|
-
* const isOdd = number => number % 2 == 1
|
|
185
|
-
*
|
|
186
|
-
* const obj = { a: 1, b: 2, c: 3, d: 4, e: 5 }
|
|
179
|
+
* const result = await filter(array, asyncIsOdd)
|
|
187
180
|
*
|
|
188
|
-
*
|
|
189
|
-
* console.log(result) // { a: 1, c: 3, e: 5 }
|
|
181
|
+
* console.log(result)
|
|
190
182
|
* ```
|
|
191
183
|
*
|
|
192
|
-
* `filter` applies the predicate to the values of
|
|
184
|
+
* `filter` applies the predicate function to just the values of objects and maps.
|
|
193
185
|
*
|
|
194
186
|
* ```javascript [playground]
|
|
195
187
|
* const isOdd = number => number % 2 == 1
|
|
196
188
|
*
|
|
197
|
-
* const
|
|
189
|
+
* const object = { a: 1, b: 2, c: 3, d: 4, e: 5 }
|
|
190
|
+
* const map = new Map([['a', 1], ['b', 2], ['c', 3], ['d', 4], ['e', 5]])
|
|
198
191
|
*
|
|
199
|
-
* const
|
|
200
|
-
*
|
|
201
|
-
* ```
|
|
202
|
-
*
|
|
203
|
-
* For generators, `filter` returns a lazily filtered generator. All values that are normally yielded by the generator that test false by the predicate are excluded from the returned generator.
|
|
204
|
-
*
|
|
205
|
-
* ```javascript [playground]
|
|
206
|
-
* const isOdd = number => number % 2 == 1
|
|
192
|
+
* const filteredObject = filter(object, isOdd)
|
|
193
|
+
* const filteredMap = filter(map, isOdd)
|
|
207
194
|
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
* }
|
|
211
|
-
*
|
|
212
|
-
* const numbersGenerator = numbersGeneratorFunction()
|
|
213
|
-
* const oddNumbersGenerator = filter(numbersGeneratorFunction(), isOdd)
|
|
214
|
-
*
|
|
215
|
-
* for (const number of numbersGenerator) {
|
|
216
|
-
* console.log(number) // 1
|
|
217
|
-
* // 2
|
|
218
|
-
* // 3
|
|
219
|
-
* // 4
|
|
220
|
-
* // 5
|
|
221
|
-
* }
|
|
222
|
-
*
|
|
223
|
-
* for (const number of oddNumbersGenerator) {
|
|
224
|
-
* console.log(number) // 1
|
|
225
|
-
* // 3
|
|
226
|
-
* // 5
|
|
227
|
-
* }
|
|
195
|
+
* console.log(filteredObject)
|
|
196
|
+
* console.log(filteredMap)
|
|
228
197
|
* ```
|
|
229
198
|
*
|
|
230
|
-
* For
|
|
199
|
+
* For generators, `filter` returns a filtered generator.
|
|
231
200
|
*
|
|
232
201
|
* ```javascript [playground]
|
|
233
|
-
* const
|
|
202
|
+
* const isOdd = number => number % 2 == 1
|
|
234
203
|
*
|
|
235
|
-
* const
|
|
204
|
+
* const generateNumbers = function* () {
|
|
236
205
|
* yield 1; yield 2; yield 3; yield 4; yield 5
|
|
237
206
|
* }
|
|
238
207
|
*
|
|
239
|
-
* const
|
|
240
|
-
*
|
|
241
|
-
* const asyncOddNumbersGenerator = filter(asyncNumbersGeneratorFunction(), asyncIsOdd)
|
|
208
|
+
* const numbers = generateNumbers()
|
|
209
|
+
* const oddNumbers = filter(generateNumbers(), isOdd)
|
|
242
210
|
*
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
* // 3
|
|
247
|
-
* // 4
|
|
248
|
-
* // 5
|
|
211
|
+
* console.log('numbers')
|
|
212
|
+
* for (const number of numbers) {
|
|
213
|
+
* console.log(number)
|
|
249
214
|
* }
|
|
250
215
|
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
* // 5
|
|
216
|
+
* console.log('odd numbers')
|
|
217
|
+
* for (const number of oddNumbers) {
|
|
218
|
+
* console.log(number)
|
|
255
219
|
* }
|
|
256
220
|
* ```
|
|
257
221
|
*
|
|
258
|
-
*
|
|
222
|
+
* If the filterable is a promise, it is resolved for its value before further execution for the eager interface only.
|
|
259
223
|
*
|
|
260
224
|
* ```javascript [playground]
|
|
261
225
|
* const isOdd = number => number % 2 == 1
|
|
262
226
|
*
|
|
263
227
|
* filter(Promise.resolve([1, 2, 3, 4, 5]), isOdd).then(console.log)
|
|
264
|
-
* // [1, 3, 5]
|
|
265
228
|
* ```
|
|
266
229
|
*
|
|
267
230
|
* See also:
|
package/flatMap.js
CHANGED
|
@@ -66,22 +66,30 @@ const _flatMap = function (value, flatMapper) {
|
|
|
66
66
|
* ```coffeescript [specscript]
|
|
67
67
|
* type Monad = Array|string|Set|Generator|AsyncGenerator|{ flatMap: string }|{ chain: string }|Object
|
|
68
68
|
*
|
|
69
|
-
* type
|
|
69
|
+
* type FlatMapper = (
|
|
70
70
|
* item any,
|
|
71
71
|
* indexOrKey number|string|any,
|
|
72
72
|
* monad Monad
|
|
73
73
|
* )=>(flatMappedItem Promise|Monad|any)
|
|
74
74
|
*
|
|
75
|
-
* flatMap(monad Promise|Monad, flatMapper
|
|
76
|
-
* flatMap(flatMapper
|
|
75
|
+
* flatMap(monad Promise|Monad, flatMapper FlatMapper) -> flatMappedMonad Promise|Monad
|
|
76
|
+
* flatMap(flatMapper FlatMapper)(monad Monad) -> flatMappedMonad Promise|Monad
|
|
77
77
|
* ```
|
|
78
78
|
*
|
|
79
79
|
* @description
|
|
80
80
|
* Applies a flat-mapper function to each item of a monad, returning a flat-mapped monad of the same type.
|
|
81
81
|
*
|
|
82
|
-
*
|
|
82
|
+
* ```javascript [playground]
|
|
83
|
+
* const duplicate = value => [value, value]
|
|
84
|
+
*
|
|
85
|
+
* const duplicated = flatMap([1, 2, 3, 4, 5], duplicate)
|
|
86
|
+
*
|
|
87
|
+
* console.log(duplicated)
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* `flatMap` iterates through each item of a monad and applies the flat-mapper function to each item, concatenating the execution result (flat-mapped item) into the flat-mapped monad. If the execution result is a promise, it is resolved for its value before being concatenated into the flat-mapped monad. If the execution result is asynchronously iterable, it is muxed into the flat-mapped monad.
|
|
83
91
|
*
|
|
84
|
-
* If the flat-mapper is asynchronous, it is executed concurrently.
|
|
92
|
+
* If the flat-mapper function is asynchronous, it is executed concurrently.
|
|
85
93
|
*
|
|
86
94
|
* The following data types are considered to be monads:
|
|
87
95
|
* * `array`
|
|
@@ -125,15 +133,7 @@ const _flatMap = function (value, flatMapper) {
|
|
|
125
133
|
* flatMapper(item any, key string, monad Object) -> flatMappedItem Promise|Monad|any
|
|
126
134
|
* ```
|
|
127
135
|
*
|
|
128
|
-
*
|
|
129
|
-
* const duplicate = value => [value, value]
|
|
130
|
-
*
|
|
131
|
-
* const duplicated = flatMap([1, 2, 3, 4, 5], duplicate)
|
|
132
|
-
*
|
|
133
|
-
* console.log(duplicated)
|
|
134
|
-
* ```
|
|
135
|
-
*
|
|
136
|
-
* If the iterable is an object with a `.flatMap` or `.chain` method, the flat-mapper function signature is defined externally.
|
|
136
|
+
* If the iterable is an object with a `flatMap` or `chain` method, the flat-mapper function signature is defined externally.
|
|
137
137
|
*
|
|
138
138
|
* Values from async generators are muxed. Muxing, or asynchronously "mixing", is the process of combining multiple asynchronous sources into one source, with order determined by the asynchronous resolution of the individual promise elements.
|
|
139
139
|
*
|
|
@@ -153,7 +153,7 @@ const _flatMap = function (value, flatMapper) {
|
|
|
153
153
|
* // values from async generators are muxed
|
|
154
154
|
* const muxed = await flatMap(['foo', 'bar', 'baz'], asyncRepeat3)
|
|
155
155
|
*
|
|
156
|
-
* console.log(muxed)
|
|
156
|
+
* console.log('muxed:', muxed)
|
|
157
157
|
*
|
|
158
158
|
* const repeat3 = function* (message) {
|
|
159
159
|
* yield message; yield message; yield message
|
|
@@ -162,7 +162,7 @@ const _flatMap = function (value, flatMapper) {
|
|
|
162
162
|
* // values from generators and other monads are concatenated
|
|
163
163
|
* const repeated = flatMap(['foo', 'bar', 'baz'], repeat3)
|
|
164
164
|
*
|
|
165
|
-
* console.log(repeated)
|
|
165
|
+
* console.log('repeated:', repeated)
|
|
166
166
|
* ```
|
|
167
167
|
*
|
|
168
168
|
* If the monad is a promise, it is resolved for its value before further execution for the eager interface only.
|