rubico 2.7.3 → 2.7.4
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 +14 -17
- package/Transducer.d.ts +10 -10
- package/Transducer.js +65 -69
- package/__.js +1 -1
- package/_internal/FlatMappingIterator.js +1 -1
- package/_internal/MappingIterator.d.ts +1 -1
- package/_internal/MappingIterator.js +1 -1
- package/_internal/arrayFilter.js +6 -6
- package/_internal/arrayFilterIndexes.js +7 -7
- package/_internal/arrayFilterWithIndex.js +6 -6
- package/_internal/arrayFind.js +7 -7
- package/_internal/arrayFlatten.js +25 -25
- package/_internal/arrayForEach.d.ts +1 -1
- package/_internal/arrayForEach.js +1 -1
- package/_internal/arrayForEachSeries.js +1 -1
- package/_internal/arrayMap.d.ts +2 -2
- package/_internal/arrayMap.js +5 -5
- package/_internal/arrayMapPool.d.ts +1 -1
- package/_internal/arrayMapPool.js +10 -10
- package/_internal/arrayMapRate.js +4 -4
- package/_internal/arrayMapSeries.d.ts +1 -1
- package/_internal/arrayMapSeries.js +8 -8
- package/_internal/arrayMapWithIndex.js +4 -4
- package/_internal/arrayReduce.js +1 -1
- package/_internal/asyncGeneratorFunctionForEach.js +3 -3
- package/_internal/asyncGeneratorFunctionMap.js +3 -3
- package/_internal/asyncIteratorFind.js +3 -3
- package/_internal/asyncIteratorForEach.d.ts +1 -1
- package/_internal/asyncIteratorForEach.js +3 -3
- package/_internal/asyncIteratorForEachSeries.js +3 -3
- package/_internal/asyncIteratorToArray.js +2 -2
- package/_internal/copyDeep.js +12 -12
- package/_internal/funcAll.js +3 -3
- package/_internal/funcAllSeries.js +6 -6
- package/_internal/funcObjectAll.js +4 -4
- package/_internal/functionArrayAll.js +3 -3
- package/_internal/functionArrayAllSeries.js +6 -6
- package/_internal/functionObjectAll.js +4 -4
- package/_internal/generatorFunctionForEach.js +3 -3
- package/_internal/generatorFunctionMap.js +3 -3
- package/_internal/generatorFunctionReduce.js +1 -1
- package/_internal/iteratorEvery.js +2 -2
- package/_internal/iteratorFind.js +7 -7
- package/_internal/iteratorForEach.d.ts +1 -1
- package/_internal/iteratorForEach.js +3 -3
- package/_internal/iteratorForEachSeries.js +1 -1
- package/_internal/iteratorReduce.d.ts +1 -1
- package/_internal/iteratorReduce.js +2 -2
- package/_internal/iteratorSome.js +2 -2
- package/_internal/mapFilter.js +4 -4
- package/_internal/mapMap.d.ts +1 -1
- package/_internal/mapMap.js +6 -6
- package/_internal/mapMapPool.js +10 -10
- package/_internal/mapMapSeries.js +10 -10
- package/_internal/objectFilter.js +6 -6
- package/_internal/objectFlatMap.d.ts +1 -1
- package/_internal/objectFlatMap.js +1 -1
- package/_internal/objectFlatten.js +14 -14
- package/_internal/objectMap.js +3 -3
- package/_internal/objectMapOwn.js +3 -3
- package/_internal/objectMapPool.js +10 -10
- package/_internal/objectMapSeries.js +9 -9
- package/_internal/objectReduce.d.ts +1 -1
- package/_internal/objectReduce.js +2 -2
- package/_internal/reducerAllSync.d.ts +2 -2
- package/_internal/reducerAllSync.js +2 -2
- package/_internal/reducerAnySync.d.ts +1 -1
- package/_internal/reducerAnySync.js +2 -2
- package/_internal/reducerConcat.d.ts +1 -1
- package/_internal/reducerConcat.js +4 -4
- package/_internal/reducerConcatSync.js +2 -2
- package/_internal/reducerEvery.d.ts +2 -2
- package/_internal/reducerEvery.js +4 -4
- package/_internal/reducerFilter.d.ts +2 -2
- package/_internal/reducerFilter.js +5 -5
- package/_internal/reducerFlatten.js +3 -3
- package/_internal/reducerForEach.d.ts +2 -2
- package/_internal/reducerForEach.js +5 -5
- package/_internal/reducerMap.d.ts +1 -1
- package/_internal/reducerMap.js +5 -5
- package/_internal/reducerSome.d.ts +2 -2
- package/_internal/reducerSome.js +4 -4
- package/_internal/reducerTryCatch.d.ts +2 -2
- package/_internal/reducerTryCatch.js +8 -8
- package/_internal/setFilter.d.ts +1 -1
- package/_internal/setFilter.js +5 -5
- package/_internal/setFlatten.js +24 -24
- package/_internal/setMap.d.ts +1 -1
- package/_internal/setMap.js +6 -6
- package/_internal/setMapPool.js +9 -9
- package/_internal/setMapSeries.js +10 -10
- package/_internal/streamFlatExtend.js +25 -25
- package/_internal/streamFlatMap.js +2 -2
- package/all.js +3 -3
- package/and.js +5 -2
- package/assign.js +2 -2
- package/compose.js +6 -2
- package/curry.js +5 -12
- package/dist/Transducer.es.js +24 -24
- package/dist/Transducer.es.min.js +1 -1
- package/dist/Transducer.js +24 -24
- package/dist/Transducer.min.js +1 -1
- package/dist/Transducer.mjs +24 -24
- 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 +14 -14
- package/dist/all.es.min.js +1 -1
- package/dist/all.js +14 -14
- package/dist/all.min.js +1 -1
- package/dist/all.mjs +14 -14
- 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 +5 -5
- package/dist/assign.es.min.js +1 -1
- package/dist/assign.js +5 -5
- package/dist/assign.min.js +1 -1
- package/dist/assign.mjs +5 -5
- 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 -7
- package/dist/every.es.min.js +1 -1
- package/dist/every.js +7 -7
- package/dist/every.min.js +1 -1
- package/dist/every.mjs +7 -7
- package/dist/filter.es.js +21 -21
- package/dist/filter.es.min.js +1 -1
- package/dist/filter.js +21 -21
- package/dist/filter.min.js +1 -1
- package/dist/filter.mjs +21 -21
- package/dist/flatMap.es.js +82 -82
- package/dist/flatMap.es.min.js +1 -1
- package/dist/flatMap.js +82 -82
- package/dist/flatMap.min.js +1 -1
- package/dist/flatMap.mjs +82 -82
- package/dist/forEach.es.js +7 -7
- package/dist/forEach.es.min.js +1 -1
- package/dist/forEach.js +7 -7
- package/dist/forEach.min.js +1 -1
- package/dist/forEach.mjs +7 -7
- 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 +83 -83
- package/dist/map.es.min.js +1 -1
- package/dist/map.js +83 -83
- package/dist/map.min.js +1 -1
- package/dist/map.mjs +83 -83
- 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 +13 -13
- package/dist/omit.es.min.js +1 -1
- package/dist/omit.js +13 -13
- package/dist/omit.min.js +1 -1
- package/dist/omit.mjs +13 -13
- 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 +5 -5
- package/dist/reduce.es.min.js +1 -1
- package/dist/reduce.js +5 -5
- package/dist/reduce.min.js +1 -1
- package/dist/reduce.mjs +5 -5
- package/dist/rubico.es.js +215 -215
- package/dist/rubico.es.min.js +1 -1
- package/dist/rubico.global.js +215 -215
- package/dist/rubico.global.min.js +1 -1
- package/dist/rubico.js +215 -215
- package/dist/rubico.min.js +1 -1
- package/dist/rubico.mjs +215 -215
- 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 +8 -8
- package/dist/some.es.min.js +1 -1
- package/dist/some.js +8 -8
- package/dist/some.min.js +1 -1
- package/dist/some.mjs +8 -8
- 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 +5 -5
- package/dist/transform.es.min.js +1 -1
- package/dist/transform.js +5 -5
- package/dist/transform.min.js +1 -1
- package/dist/transform.mjs +5 -5
- 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 +8 -8
- package/dist/x/append.es.min.js +1 -1
- package/dist/x/append.js +8 -8
- package/dist/x/append.min.js +1 -1
- package/dist/x/append.mjs +8 -8
- 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 +69 -37
- package/dist/x/defaultsDeep.es.min.js +2 -2
- package/dist/x/defaultsDeep.js +69 -37
- package/dist/x/defaultsDeep.min.js +2 -2
- package/dist/x/defaultsDeep.mjs +69 -37
- package/dist/x/differenceWith.es.js +14 -14
- package/dist/x/differenceWith.es.min.js +1 -1
- package/dist/x/differenceWith.js +14 -14
- package/dist/x/differenceWith.min.js +1 -1
- package/dist/x/differenceWith.mjs +14 -14
- package/dist/x/filterOut.es.js +21 -21
- package/dist/x/filterOut.es.min.js +1 -1
- package/dist/x/filterOut.js +21 -21
- package/dist/x/filterOut.min.js +1 -1
- package/dist/x/filterOut.mjs +21 -21
- package/dist/x/find.es.js +18 -18
- package/dist/x/find.es.min.js +1 -1
- package/dist/x/find.js +18 -18
- package/dist/x/find.min.js +1 -1
- package/dist/x/find.mjs +18 -18
- 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 +82 -82
- package/dist/x/flatten.es.min.js +1 -1
- package/dist/x/flatten.js +82 -82
- package/dist/x/flatten.min.js +1 -1
- package/dist/x/flatten.mjs +82 -82
- package/dist/x/groupBy.es.js +17 -17
- package/dist/x/groupBy.es.min.js +1 -1
- package/dist/x/groupBy.js +17 -17
- package/dist/x/groupBy.min.js +1 -1
- package/dist/x/groupBy.mjs +17 -17
- 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 +6 -6
- package/dist/x/maxBy.es.min.js +1 -1
- package/dist/x/maxBy.js +6 -6
- package/dist/x/maxBy.min.js +1 -1
- package/dist/x/maxBy.mjs +6 -6
- 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 +83 -83
- package/dist/x/pluck.es.min.js +1 -1
- package/dist/x/pluck.js +83 -83
- package/dist/x/pluck.min.js +1 -1
- package/dist/x/pluck.mjs +83 -83
- package/dist/x/prepend.es.js +8 -8
- package/dist/x/prepend.es.min.js +1 -1
- package/dist/x/prepend.js +8 -8
- package/dist/x/prepend.min.js +1 -1
- package/dist/x/prepend.mjs +8 -8
- 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 +39 -39
- package/dist/x/unionWith.es.min.js +1 -1
- package/dist/x/unionWith.js +39 -39
- package/dist/x/unionWith.min.js +1 -1
- package/dist/x/unionWith.mjs +39 -39
- 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 +32 -10
- package/es.js +215 -215
- package/every.d.ts +1 -1
- package/every.js +6 -3
- package/filter.d.ts +3 -3
- package/filter.js +14 -14
- package/flatMap.d.ts +9 -9
- package/flatMap.js +9 -9
- package/forEach.d.ts +1 -1
- package/forEach.js +19 -15
- package/gt.js +30 -13
- package/gte.js +31 -12
- package/index.js +215 -215
- package/lt.js +28 -9
- package/lte.js +34 -15
- package/map.d.ts +3 -3
- package/map.js +31 -31
- package/monad/Mux.benchmark.js +1 -1
- package/monad/Mux.js +6 -6
- package/monad/Struct.js +2 -2
- package/not.js +15 -7
- package/or.js +5 -2
- package/package.json +1 -1
- package/pipe.js +7 -13
- package/reduce.d.ts +7 -7
- package/reduce.js +16 -16
- package/some.d.ts +1 -1
- package/some.js +6 -3
- package/switchCase.d.ts +1 -1
- package/switchCase.js +7 -4
- package/tap.js +14 -4
- package/thunkify.js +2 -0
- package/transform.d.ts +1 -1
- package/transform.js +6 -15
- package/tryCatch.js +8 -2
- package/x/README.md +8 -8
- package/x/append.d.ts +2 -2
- package/x/append.js +8 -8
- package/x/defaultsDeep.js +94 -57
- package/x/defaultsDeep.test.js +24 -1
- package/x/differenceWith.js +13 -13
- package/x/find.d.ts +1 -1
- package/x/find.js +1 -1
- package/x/find.test.js +2 -2
- package/x/findIndex.test.js +1 -1
- package/x/first.d.ts +1 -1
- package/x/first.js +1 -1
- package/x/first.test.js +1 -1
- package/x/groupBy.d.ts +1 -1
- package/x/groupBy.js +13 -13
- package/x/last.d.ts +1 -1
- package/x/last.js +1 -1
- package/x/last.test.js +1 -1
- package/x/maxBy.d.ts +7 -7
- package/x/maxBy.js +13 -13
- package/x/maxBy.test.js +5 -5
- package/x/pluck.test.js +1 -1
- package/x/prepend.d.ts +2 -2
- package/x/prepend.js +8 -8
- package/x/size.d.ts +1 -1
- package/x/size.js +1 -1
- package/x/unionWith.js +11 -11
- package/x/unionWith.test.js +5 -5
package/_internal/reducerMap.js
CHANGED
|
@@ -21,11 +21,11 @@ const curry2 = require('./curry2')
|
|
|
21
21
|
*/
|
|
22
22
|
const reducerMap = (
|
|
23
23
|
reducer, mapper,
|
|
24
|
-
) => function mappingReducer(result,
|
|
25
|
-
const
|
|
26
|
-
return isPromise(
|
|
27
|
-
?
|
|
28
|
-
: reducer(result,
|
|
24
|
+
) => function mappingReducer(result, reducerElement) {
|
|
25
|
+
const mappingReducerElement = mapper(reducerElement)
|
|
26
|
+
return isPromise(mappingReducerElement)
|
|
27
|
+
? mappingReducerElement.then(curry2(reducer, result, __))
|
|
28
|
+
: reducer(result, mappingReducerElement)
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
module.exports = reducerMap
|
|
@@ -6,11 +6,11 @@ export = reducerSome;
|
|
|
6
6
|
* ```coffeescript [specscript]
|
|
7
7
|
* reducerSome(
|
|
8
8
|
* predicate any=>boolean,
|
|
9
|
-
* ) -> anyReducer (result boolean,
|
|
9
|
+
* ) -> anyReducer (result boolean, element any)=>boolean
|
|
10
10
|
* ```
|
|
11
11
|
*
|
|
12
12
|
* @related foldableAllReducer
|
|
13
13
|
*
|
|
14
14
|
* @TODO throw to break early?
|
|
15
15
|
*/
|
|
16
|
-
declare function reducerSome(predicate: any): (result: any,
|
|
16
|
+
declare function reducerSome(predicate: any): (result: any, element: any) => any;
|
package/_internal/reducerSome.js
CHANGED
|
@@ -10,17 +10,17 @@ const isPromise = require('./isPromise')
|
|
|
10
10
|
* ```coffeescript [specscript]
|
|
11
11
|
* reducerSome(
|
|
12
12
|
* predicate any=>boolean,
|
|
13
|
-
* ) -> anyReducer (result boolean,
|
|
13
|
+
* ) -> anyReducer (result boolean, element any)=>boolean
|
|
14
14
|
* ```
|
|
15
15
|
*
|
|
16
16
|
* @related foldableAllReducer
|
|
17
17
|
*
|
|
18
18
|
* @TODO throw to break early?
|
|
19
19
|
*/
|
|
20
|
-
const reducerSome = predicate => function anyReducer(result,
|
|
20
|
+
const reducerSome = predicate => function anyReducer(result, element) {
|
|
21
21
|
return result === true ? result
|
|
22
|
-
: isPromise(result) ? result.then(curry2(reducerAnySync(predicate), __,
|
|
23
|
-
: result ? true : predicate(
|
|
22
|
+
: isPromise(result) ? result.then(curry2(reducerAnySync(predicate), __, element))
|
|
23
|
+
: result ? true : predicate(element)
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
module.exports = reducerSome
|
|
@@ -4,7 +4,7 @@ export = reducerTryCatch;
|
|
|
4
4
|
*
|
|
5
5
|
* @synopsis
|
|
6
6
|
* ```coffeescript [specscript]
|
|
7
|
-
* type Reducer = (accum any,
|
|
7
|
+
* type Reducer = (accum any, element any)=>(nextAccumulator Promise|any)
|
|
8
8
|
*
|
|
9
9
|
* reducerTryCatch(
|
|
10
10
|
* reducer function,
|
|
@@ -12,4 +12,4 @@ export = reducerTryCatch;
|
|
|
12
12
|
* ) -> errorHandlingReducer function
|
|
13
13
|
* ```
|
|
14
14
|
*/
|
|
15
|
-
declare function reducerTryCatch(reducer: any, transducerTryer: any, catcher: any): (accum: any,
|
|
15
|
+
declare function reducerTryCatch(reducer: any, transducerTryer: any, catcher: any): (accum: any, element: any) => any;
|
|
@@ -12,14 +12,14 @@ const curry2 = require('./curry2')
|
|
|
12
12
|
* reducer function,
|
|
13
13
|
* error Error,
|
|
14
14
|
* accum any,
|
|
15
|
-
*
|
|
15
|
+
* element any,
|
|
16
16
|
* ) -> Promise|any
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
19
|
const _reducerTryCatchErrorHandler = function (
|
|
20
|
-
catcher, reducer, error, accum,
|
|
20
|
+
catcher, reducer, error, accum, element,
|
|
21
21
|
) {
|
|
22
|
-
const c = catcher(error,
|
|
22
|
+
const c = catcher(error, element)
|
|
23
23
|
return isPromise(c) ? c.then(curry2(reducer, accum, __)) : reducer(accum, c)
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -28,7 +28,7 @@ const _reducerTryCatchErrorHandler = function (
|
|
|
28
28
|
*
|
|
29
29
|
* @synopsis
|
|
30
30
|
* ```coffeescript [specscript]
|
|
31
|
-
* type Reducer = (accum any,
|
|
31
|
+
* type Reducer = (accum any, element any)=>(nextAccumulator Promise|any)
|
|
32
32
|
*
|
|
33
33
|
* reducerTryCatch(
|
|
34
34
|
* reducer function,
|
|
@@ -38,15 +38,15 @@ const _reducerTryCatchErrorHandler = function (
|
|
|
38
38
|
*/
|
|
39
39
|
const reducerTryCatch = function (reducer, transducerTryer, catcher) {
|
|
40
40
|
const finalReducer = transducerTryer(reducer)
|
|
41
|
-
return function errorHandlingReducer(accum,
|
|
41
|
+
return function errorHandlingReducer(accum, element) {
|
|
42
42
|
try {
|
|
43
|
-
const ret = finalReducer(accum,
|
|
43
|
+
const ret = finalReducer(accum, element)
|
|
44
44
|
return isPromise(ret) ? ret.catch(curry5(
|
|
45
|
-
_reducerTryCatchErrorHandler, catcher, reducer, __, accum,
|
|
45
|
+
_reducerTryCatchErrorHandler, catcher, reducer, __, accum, element,
|
|
46
46
|
)) : ret
|
|
47
47
|
} catch (error) {
|
|
48
48
|
return _reducerTryCatchErrorHandler(
|
|
49
|
-
catcher, reducer, error, accum,
|
|
49
|
+
catcher, reducer, error, accum, element,
|
|
50
50
|
)
|
|
51
51
|
}
|
|
52
52
|
}
|
package/_internal/setFilter.d.ts
CHANGED
|
@@ -11,6 +11,6 @@ export = setFilter;
|
|
|
11
11
|
* ```
|
|
12
12
|
*
|
|
13
13
|
* @description
|
|
14
|
-
* Filter
|
|
14
|
+
* Filter elements of a Set concurrently by predicate. `predicate` may be asynchronous.
|
|
15
15
|
*/
|
|
16
16
|
declare function setFilter(value: any, predicate: any): any;
|
package/_internal/setFilter.js
CHANGED
|
@@ -19,19 +19,19 @@ const noop = require('./noop')
|
|
|
19
19
|
* ```
|
|
20
20
|
*
|
|
21
21
|
* @description
|
|
22
|
-
* Filter
|
|
22
|
+
* Filter elements of a Set concurrently by predicate. `predicate` may be asynchronous.
|
|
23
23
|
*/
|
|
24
24
|
const setFilter = function (value, predicate) {
|
|
25
25
|
const result = new Set(),
|
|
26
26
|
resultAdd = result.add.bind(result),
|
|
27
27
|
promises = []
|
|
28
|
-
for (const
|
|
29
|
-
const predication = predicate(
|
|
28
|
+
for (const element of value) {
|
|
29
|
+
const predication = predicate(element, element, value)
|
|
30
30
|
if (isPromise(predication)) {
|
|
31
31
|
promises.push(predication.then(curry3(
|
|
32
|
-
thunkConditional, __, thunkify1(resultAdd,
|
|
32
|
+
thunkConditional, __, thunkify1(resultAdd, element), noop)))
|
|
33
33
|
} else if (predication) {
|
|
34
|
-
result.add(
|
|
34
|
+
result.add(element)
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
return promises.length == 0
|
package/_internal/setFlatten.js
CHANGED
|
@@ -30,45 +30,45 @@ const setFlatten = function (set) {
|
|
|
30
30
|
const size = set.size,
|
|
31
31
|
promises = [],
|
|
32
32
|
result = new Set(),
|
|
33
|
-
resultAddReducer = (_,
|
|
33
|
+
resultAddReducer = (_, subElement) => result.add(subElement),
|
|
34
34
|
resultAdd = curry3(callPropUnary, result, 'add', __),
|
|
35
35
|
getResult = () => result
|
|
36
36
|
|
|
37
|
-
for (const
|
|
38
|
-
if (isArray(
|
|
39
|
-
const
|
|
40
|
-
let
|
|
41
|
-
while (++
|
|
42
|
-
result.add(
|
|
37
|
+
for (const element of set) {
|
|
38
|
+
if (isArray(element)) {
|
|
39
|
+
const elementLength = element.length
|
|
40
|
+
let elementIndex = -1
|
|
41
|
+
while (++elementIndex < elementLength) {
|
|
42
|
+
result.add(element[elementIndex])
|
|
43
43
|
}
|
|
44
|
-
} else if (
|
|
45
|
-
result.add(
|
|
46
|
-
} else if (typeof
|
|
47
|
-
for (const
|
|
48
|
-
result.add(
|
|
44
|
+
} else if (element == null) {
|
|
45
|
+
result.add(element)
|
|
46
|
+
} else if (typeof element[symbolIterator] == 'function') {
|
|
47
|
+
for (const subElement of element) {
|
|
48
|
+
result.add(subElement)
|
|
49
49
|
}
|
|
50
|
-
} else if (typeof
|
|
50
|
+
} else if (typeof element[symbolAsyncIterator] == 'function') {
|
|
51
51
|
promises.push(
|
|
52
|
-
asyncIteratorForEach(
|
|
53
|
-
} else if (typeof
|
|
54
|
-
const monadValue =
|
|
52
|
+
asyncIteratorForEach(element[symbolAsyncIterator](), resultAdd))
|
|
53
|
+
} else if (typeof element.chain == 'function') {
|
|
54
|
+
const monadValue = element.chain(identity)
|
|
55
55
|
isPromise(monadValue)
|
|
56
56
|
? promises.push(monadValue.then(resultAdd))
|
|
57
57
|
: result.add(monadValue)
|
|
58
|
-
} else if (typeof
|
|
59
|
-
const monadValue =
|
|
58
|
+
} else if (typeof element.flatMap == 'function') {
|
|
59
|
+
const monadValue = element.flatMap(identity)
|
|
60
60
|
isPromise(monadValue)
|
|
61
61
|
? promises.push(monadValue.then(resultAdd))
|
|
62
62
|
: result.add(monadValue)
|
|
63
|
-
} else if (typeof
|
|
64
|
-
const folded =
|
|
63
|
+
} else if (typeof element.reduce == 'function') {
|
|
64
|
+
const folded = element.reduce(resultAddReducer, null)
|
|
65
65
|
isPromise(folded) && promises.push(folded)
|
|
66
|
-
} else if (
|
|
67
|
-
for (const key in
|
|
68
|
-
result.add(
|
|
66
|
+
} else if (element.constructor == Object) {
|
|
67
|
+
for (const key in element) {
|
|
68
|
+
result.add(element[key])
|
|
69
69
|
}
|
|
70
70
|
} else {
|
|
71
|
-
result.add(
|
|
71
|
+
result.add(element)
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
return promises.length == 0 ? result : promiseAll(promises).then(getResult)
|
package/_internal/setMap.d.ts
CHANGED
|
@@ -12,6 +12,6 @@ export = setMap;
|
|
|
12
12
|
* ```
|
|
13
13
|
*
|
|
14
14
|
* @description
|
|
15
|
-
* Apply a mapper concurrently to each
|
|
15
|
+
* Apply a mapper concurrently to each element of a set, returning a set of results.
|
|
16
16
|
*/
|
|
17
17
|
declare function setMap(set: any, mapper: any): any;
|
package/_internal/setMap.js
CHANGED
|
@@ -18,17 +18,17 @@ const callPropUnary = require('./callPropUnary')
|
|
|
18
18
|
* ```
|
|
19
19
|
*
|
|
20
20
|
* @description
|
|
21
|
-
* Apply a mapper concurrently to each
|
|
21
|
+
* Apply a mapper concurrently to each element of a set, returning a set of results.
|
|
22
22
|
*/
|
|
23
23
|
const setMap = function (set, mapper) {
|
|
24
24
|
const result = new Set(),
|
|
25
25
|
promises = []
|
|
26
|
-
for (const
|
|
27
|
-
const
|
|
28
|
-
if (isPromise(
|
|
29
|
-
promises.push(
|
|
26
|
+
for (const element of set) {
|
|
27
|
+
const resultElement = mapper(element, element, set)
|
|
28
|
+
if (isPromise(resultElement)) {
|
|
29
|
+
promises.push(resultElement.then(curry3(callPropUnary, result, 'add', __)))
|
|
30
30
|
} else {
|
|
31
|
-
result.add(
|
|
31
|
+
result.add(resultElement)
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
return promises.length == 0
|
package/_internal/setMapPool.js
CHANGED
|
@@ -26,15 +26,15 @@ const _setMapPoolAsync = async function (
|
|
|
26
26
|
if (promises.size >= concurrency) {
|
|
27
27
|
await promiseRace(promises)
|
|
28
28
|
}
|
|
29
|
-
const
|
|
30
|
-
if (isPromise(
|
|
31
|
-
const selfDeletingPromise =
|
|
29
|
+
const resultElement = f(iteration.value, iteration.value, s)
|
|
30
|
+
if (isPromise(resultElement)) {
|
|
31
|
+
const selfDeletingPromise = resultElement.then(resolvedValue => {
|
|
32
32
|
promises.delete(selfDeletingPromise)
|
|
33
33
|
result.add(resolvedValue)
|
|
34
34
|
})
|
|
35
35
|
promises.add(selfDeletingPromise)
|
|
36
36
|
} else {
|
|
37
|
-
result.add(
|
|
37
|
+
result.add(resultElement)
|
|
38
38
|
}
|
|
39
39
|
iteration = iterator.next()
|
|
40
40
|
}
|
|
@@ -53,24 +53,24 @@ const _setMapPoolAsync = async function (
|
|
|
53
53
|
* ```
|
|
54
54
|
*
|
|
55
55
|
* @description
|
|
56
|
-
* Apply a function `f` with limited concurrency to each
|
|
56
|
+
* Apply a function `f` with limited concurrency to each element of a set `s`, returning an array of results.
|
|
57
57
|
*/
|
|
58
58
|
const setMapPool = function (s, concurrency, f) {
|
|
59
59
|
const result = new Set()
|
|
60
60
|
const iterator = s[symbolIterator]()
|
|
61
61
|
let iteration = iterator.next()
|
|
62
62
|
while (!iteration.done) {
|
|
63
|
-
const
|
|
64
|
-
if (isPromise(
|
|
63
|
+
const resultElement = f(iteration.value, iteration.value, s)
|
|
64
|
+
if (isPromise(resultElement)) {
|
|
65
65
|
const promises = new Set()
|
|
66
|
-
const selfDeletingPromise =
|
|
66
|
+
const selfDeletingPromise = resultElement.then(resolvedValue => {
|
|
67
67
|
promises.delete(selfDeletingPromise)
|
|
68
68
|
result.add(resolvedValue)
|
|
69
69
|
})
|
|
70
70
|
promises.add(selfDeletingPromise)
|
|
71
71
|
return _setMapPoolAsync(s, iterator, concurrency, f, result, promises)
|
|
72
72
|
}
|
|
73
|
-
result.add(
|
|
73
|
+
result.add(resultElement)
|
|
74
74
|
iteration = iterator.next()
|
|
75
75
|
}
|
|
76
76
|
return result
|
|
@@ -14,11 +14,11 @@ const symbolIterator = require('./symbolIterator')
|
|
|
14
14
|
const _setMapSeriesAsync = async function (iterator, f, result) {
|
|
15
15
|
let iteration = iterator.next()
|
|
16
16
|
while (!iteration.done) {
|
|
17
|
-
let
|
|
18
|
-
if (isPromise(
|
|
19
|
-
|
|
17
|
+
let resultElement = f(iteration.value)
|
|
18
|
+
if (isPromise(resultElement)) {
|
|
19
|
+
resultElement = await resultElement
|
|
20
20
|
}
|
|
21
|
-
result.add(
|
|
21
|
+
result.add(resultElement)
|
|
22
22
|
iteration = iterator.next()
|
|
23
23
|
}
|
|
24
24
|
return result
|
|
@@ -33,27 +33,27 @@ const _setMapSeriesAsync = async function (iterator, f, result) {
|
|
|
33
33
|
* value any,
|
|
34
34
|
* key any,
|
|
35
35
|
* collection Set
|
|
36
|
-
* )=>(
|
|
36
|
+
* )=>(resultElement Promise|any)
|
|
37
37
|
*
|
|
38
38
|
* setMapSeries(set Set, f SetMapper) -> Promise|Set
|
|
39
39
|
* ```
|
|
40
40
|
*
|
|
41
41
|
* @description
|
|
42
|
-
* Apply a mapper in series to each value of a set, returning a new set of mapped
|
|
42
|
+
* Apply a mapper in series to each value of a set, returning a new set of mapped elements. Mapper may be asynchronous.
|
|
43
43
|
*/
|
|
44
44
|
const setMapSeries = function (set, f) {
|
|
45
45
|
const result = new Set()
|
|
46
46
|
const iterator = set[symbolIterator]()
|
|
47
47
|
let iteration = iterator.next()
|
|
48
48
|
while (!iteration.done) {
|
|
49
|
-
const
|
|
50
|
-
if (isPromise(
|
|
51
|
-
return
|
|
49
|
+
const resultElement = f(iteration.value)
|
|
50
|
+
if (isPromise(resultElement)) {
|
|
51
|
+
return resultElement.then(funcConcat(
|
|
52
52
|
curry2(setAdd, result, __),
|
|
53
53
|
thunkify3(_setMapSeriesAsync, iterator, f, result),
|
|
54
54
|
))
|
|
55
55
|
}
|
|
56
|
-
result.add(
|
|
56
|
+
result.add(resultElement)
|
|
57
57
|
iteration = iterator.next()
|
|
58
58
|
}
|
|
59
59
|
return result
|
|
@@ -26,49 +26,49 @@ const symbolAsyncIterator = require('./symbolAsyncIterator')
|
|
|
26
26
|
*
|
|
27
27
|
* streamFlatExtend<T>(
|
|
28
28
|
* stream Stream<T>,
|
|
29
|
-
*
|
|
29
|
+
* element <Monad<T>|Foldable<T>|T>
|
|
30
30
|
* ) -> stream
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
|
-
const streamFlatExtend = async function (stream,
|
|
33
|
+
const streamFlatExtend = async function (stream, element) {
|
|
34
34
|
const resultStreamWrite = curry2(streamWrite, stream, __),
|
|
35
|
-
// resultStreamWriteReducer = (_,
|
|
35
|
+
// resultStreamWriteReducer = (_, subElement) => stream.write(subElement),
|
|
36
36
|
resultStreamWriteReducer = funcConcatSync(getArg1, resultStreamWrite),
|
|
37
37
|
promises = []
|
|
38
|
-
if (isArray(
|
|
39
|
-
const
|
|
40
|
-
let
|
|
41
|
-
while (++
|
|
42
|
-
stream.write(
|
|
38
|
+
if (isArray(element)) {
|
|
39
|
+
const elementLength = element.length
|
|
40
|
+
let elementIndex = -1
|
|
41
|
+
while (++elementIndex < elementLength) {
|
|
42
|
+
stream.write(element[elementIndex])
|
|
43
43
|
}
|
|
44
|
-
} else if (
|
|
45
|
-
stream.write(
|
|
46
|
-
} else if (typeof
|
|
47
|
-
for (const
|
|
48
|
-
stream.write(
|
|
44
|
+
} else if (element == null) {
|
|
45
|
+
stream.write(element)
|
|
46
|
+
} else if (typeof element[symbolIterator] == 'function') {
|
|
47
|
+
for (const subElement of element) {
|
|
48
|
+
stream.write(subElement)
|
|
49
49
|
}
|
|
50
|
-
} else if (typeof
|
|
50
|
+
} else if (typeof element[symbolAsyncIterator] == 'function') {
|
|
51
51
|
promises.push(
|
|
52
|
-
asyncIteratorForEach(
|
|
53
|
-
} else if (typeof
|
|
54
|
-
const monadValue =
|
|
52
|
+
asyncIteratorForEach(element[symbolAsyncIterator](), resultStreamWrite))
|
|
53
|
+
} else if (typeof element.chain == 'function') {
|
|
54
|
+
const monadValue = element.chain(identity)
|
|
55
55
|
isPromise(monadValue)
|
|
56
56
|
? promises.push(monadValue.then(resultStreamWrite))
|
|
57
57
|
: stream.write(monadValue)
|
|
58
|
-
} else if (typeof
|
|
59
|
-
const monadValue =
|
|
58
|
+
} else if (typeof element.flatMap == 'function') {
|
|
59
|
+
const monadValue = element.flatMap(identity)
|
|
60
60
|
isPromise(monadValue)
|
|
61
61
|
? promises.push(monadValue.then(resultStreamWrite))
|
|
62
62
|
: stream.write(monadValue)
|
|
63
|
-
} else if (typeof
|
|
64
|
-
const folded =
|
|
63
|
+
} else if (typeof element.reduce == 'function') {
|
|
64
|
+
const folded = element.reduce(resultStreamWriteReducer, null)
|
|
65
65
|
isPromise(folded) && promises.push(folded)
|
|
66
|
-
} else if (
|
|
67
|
-
for (const key in
|
|
68
|
-
stream.write(
|
|
66
|
+
} else if (element.constructor == Object) {
|
|
67
|
+
for (const key in element) {
|
|
68
|
+
stream.write(element[key])
|
|
69
69
|
}
|
|
70
70
|
} else {
|
|
71
|
-
stream.write(
|
|
71
|
+
stream.write(element)
|
|
72
72
|
}
|
|
73
73
|
return promises.length == 0
|
|
74
74
|
? stream
|
|
@@ -24,8 +24,8 @@ const promiseAll = require('./promiseAll')
|
|
|
24
24
|
*/
|
|
25
25
|
const streamFlatMap = async function (stream, flatMapper) {
|
|
26
26
|
const promises = new Set()
|
|
27
|
-
for await (const
|
|
28
|
-
const monad = flatMapper(
|
|
27
|
+
for await (const element of stream) {
|
|
28
|
+
const monad = flatMapper(element)
|
|
29
29
|
if (isPromise(monad)) {
|
|
30
30
|
const selfDeletingPromise = monad.then(
|
|
31
31
|
curry2(streamFlatExtend, stream, __)).then(
|
package/all.js
CHANGED
|
@@ -39,10 +39,10 @@ const _allValues = function (values) {
|
|
|
39
39
|
* args Array<any>
|
|
40
40
|
* argsOrPromises Array<Promise|any>
|
|
41
41
|
*
|
|
42
|
-
* type
|
|
42
|
+
* type SyncOrAsyncResolver = (...args)=>Promise|any
|
|
43
43
|
*
|
|
44
|
-
* arrayResolversOrPromisesOrValues Array<
|
|
45
|
-
* objectResolversOrPromisesOrValues Object<
|
|
44
|
+
* arrayResolversOrPromisesOrValues Array<SyncOrAsyncResolver|Promise|any>
|
|
45
|
+
* objectResolversOrPromisesOrValues Object<SyncOrAsyncResolver|Promise|any>
|
|
46
46
|
*
|
|
47
47
|
* all(arrayValues Promise|Array<Promise|any>) -> arrayResult Promise|Array
|
|
48
48
|
* all(...argsOrPromises, arrayResolversOrPromisesOrValues) -> arrayResult Promise|Array
|
package/and.js
CHANGED
|
@@ -99,7 +99,10 @@ const areAllPredicatesTruthy = function (args, predicates) {
|
|
|
99
99
|
* ```coffeescript [specscript]
|
|
100
100
|
* args Array<any>
|
|
101
101
|
* argsOrPromises Array<Promise|any>
|
|
102
|
-
*
|
|
102
|
+
*
|
|
103
|
+
* type SyncOrAsyncPredicate = (...args)=>Promise|boolean|any
|
|
104
|
+
*
|
|
105
|
+
* predicatesOrValues Array<SyncOrAsyncPredicate|boolean|any>
|
|
103
106
|
*
|
|
104
107
|
* and(values Array<boolean|any>) -> result boolean
|
|
105
108
|
* and(...argsOrPromises, predicatesOrValues) -> Promise|boolean
|
|
@@ -107,7 +110,7 @@ const areAllPredicatesTruthy = function (args, predicates) {
|
|
|
107
110
|
* ```
|
|
108
111
|
*
|
|
109
112
|
* @description
|
|
110
|
-
* Function equivalent to the [
|
|
113
|
+
* Function equivalent to the [Logical AND](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_AND) operator. Tests an array of predicate functions, promises, values, or a mix thereof.
|
|
111
114
|
*
|
|
112
115
|
* If provided an array of boolean values, `and` returns true if all boolean values are true.
|
|
113
116
|
*
|
package/assign.js
CHANGED
|
@@ -20,9 +20,9 @@ const _assign = function (object, funcs) {
|
|
|
20
20
|
* ```coffeescript [specscript]
|
|
21
21
|
* args Array<any>
|
|
22
22
|
*
|
|
23
|
-
* type
|
|
23
|
+
* type UnarySyncOrAsyncResolver = any=>Promise|any
|
|
24
24
|
*
|
|
25
|
-
* objectResolversOrPromisesOrValues Object<
|
|
25
|
+
* objectResolversOrPromisesOrValues Object<UnarySyncOrAsyncResolver|Promise|any>
|
|
26
26
|
*
|
|
27
27
|
* assign(argumentObject Promise|Object, objectResolversOrPromisesOrValues) -> resultObject
|
|
28
28
|
* assign(objectResolversOrPromisesOrValues)(argumentObject Object) -> resultObject
|
package/compose.js
CHANGED
|
@@ -10,17 +10,21 @@ const funcConcat = require('./_internal/funcConcat')
|
|
|
10
10
|
*
|
|
11
11
|
* @synopsis
|
|
12
12
|
* ```coffeescript [specscript]
|
|
13
|
-
* funcs Array<function>
|
|
14
13
|
* args Array<any>
|
|
15
14
|
* argsOrPromises Array<Promise|any>
|
|
16
15
|
*
|
|
16
|
+
* type SyncOrAsyncFunction = (...args)=>Promise|any
|
|
17
|
+
* type UnarySyncOrAsyncFunction = any=>Promise|any
|
|
18
|
+
*
|
|
19
|
+
* funcs [SyncOrAsyncFunction, ...Array<UnarySyncOrAsyncFunction>]
|
|
20
|
+
*
|
|
17
21
|
* compose(funcs)(...args) -> result Promise|any
|
|
18
22
|
* compose(...argsOrPromises, funcs) -> result Promise|any
|
|
19
23
|
* compose(...funcs)(...args) -> result Promise|any
|
|
20
24
|
* ```
|
|
21
25
|
*
|
|
22
26
|
* @description
|
|
23
|
-
* Creates a function composition from multiple functions. Each function in the composition is evaluated starting from the last function in the composition in series, passing its return value as an argument to the previous function. The result of a composition execution is the return value of the first function in the composition. If any function in the composition is asynchronous, the result of the composition execution is a Promise.
|
|
27
|
+
* Creates a function composition from multiple functions. Each function in the composition is evaluated starting from the last function in the composition in series, passing its return value as an argument to the previous function. The result of a composition execution is the return value of the first function in the composition. All arguments provided to the composition are provided to the last function in the composition. If any function in the composition is asynchronous, the result of the composition execution is a Promise.
|
|
24
28
|
*
|
|
25
29
|
* ```javascript [playground]
|
|
26
30
|
* const f = x => x * 2
|
package/curry.js
CHANGED
|
@@ -5,17 +5,14 @@ const curryArity = require('./_internal/curryArity')
|
|
|
5
5
|
*
|
|
6
6
|
* @synopsis
|
|
7
7
|
* ```coffeescript [specscript]
|
|
8
|
-
*
|
|
8
|
+
* __ Symbol(placeholder)
|
|
9
|
+
*
|
|
9
10
|
* type ArgsWithPlaceholder = Array<__|any>
|
|
10
11
|
*
|
|
11
12
|
* args ArgsWithPlaceholder
|
|
12
13
|
* moreArgs ArgsWithPlaceholder
|
|
13
14
|
*
|
|
14
|
-
* curry(
|
|
15
|
-
* func function,
|
|
16
|
-
* ...args
|
|
17
|
-
* ) -> curriedFuncOrResult function|any
|
|
18
|
-
*
|
|
15
|
+
* curry(func function, ...args) -> curriedFuncOrResult function|any
|
|
19
16
|
* curriedFuncOrResult(...moreArgs) -> anotherCurriedFuncOrResult function|any
|
|
20
17
|
* ```
|
|
21
18
|
*
|
|
@@ -55,15 +52,11 @@ const curry = (func, ...args) => curryArity(func.length, func, args)
|
|
|
55
52
|
* type __ = Symbol(placeholder)
|
|
56
53
|
* type ArgsWithPlaceholder = Array<__|any>
|
|
57
54
|
*
|
|
55
|
+
* n number
|
|
58
56
|
* args ArgsWithPlaceholder
|
|
59
57
|
* moreArgs ArgsWithPlaceholder
|
|
60
58
|
*
|
|
61
|
-
* curry.arity(
|
|
62
|
-
* arity number,
|
|
63
|
-
* func function,
|
|
64
|
-
* ...args
|
|
65
|
-
* ) -> curriedFuncOrResult function|any
|
|
66
|
-
*
|
|
59
|
+
* curry.arity(n number, func function, ...args) -> curriedFuncOrResult function|any
|
|
67
60
|
* curriedFuncOrResult(...moreArgs) -> anotherCurriedFuncOrResult function|any
|
|
68
61
|
* ```
|
|
69
62
|
*
|