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
|
@@ -30,7 +30,7 @@ const _arrayForEachSeriesAsync = async function (array, callback, index) {
|
|
|
30
30
|
* ```
|
|
31
31
|
*
|
|
32
32
|
* @description
|
|
33
|
-
* Call a callback for each
|
|
33
|
+
* Call a callback for each element of an array in series. Return a promise if any executions are asynchronous.
|
|
34
34
|
*/
|
|
35
35
|
const arrayForEachSeries = function (array, callback) {
|
|
36
36
|
const length = array.length
|
package/_internal/arrayMap.d.ts
CHANGED
|
@@ -6,11 +6,11 @@ export = arrayMap;
|
|
|
6
6
|
* ```coffeescript [specscript]
|
|
7
7
|
* arrayMap(
|
|
8
8
|
* array Array,
|
|
9
|
-
* mapper (
|
|
9
|
+
* mapper (element any, index number, array Array)=>Promise|any,
|
|
10
10
|
* ) -> Promise|Array
|
|
11
11
|
* ```
|
|
12
12
|
*
|
|
13
13
|
* @description
|
|
14
|
-
* Apply a mapper to each
|
|
14
|
+
* Apply a mapper to each element of an array, returning an array. Mapper may be asynchronous.
|
|
15
15
|
*/
|
|
16
16
|
declare function arrayMap(array: any, mapper: any): any;
|
package/_internal/arrayMap.js
CHANGED
|
@@ -8,12 +8,12 @@ const promiseAll = require('./promiseAll')
|
|
|
8
8
|
* ```coffeescript [specscript]
|
|
9
9
|
* arrayMap(
|
|
10
10
|
* array Array,
|
|
11
|
-
* mapper (
|
|
11
|
+
* mapper (element any, index number, array Array)=>Promise|any,
|
|
12
12
|
* ) -> Promise|Array
|
|
13
13
|
* ```
|
|
14
14
|
*
|
|
15
15
|
* @description
|
|
16
|
-
* Apply a mapper to each
|
|
16
|
+
* Apply a mapper to each element of an array, returning an array. Mapper may be asynchronous.
|
|
17
17
|
*/
|
|
18
18
|
const arrayMap = function (array, mapper) {
|
|
19
19
|
const arrayLength = array.length,
|
|
@@ -22,11 +22,11 @@ const arrayMap = function (array, mapper) {
|
|
|
22
22
|
isAsync = false
|
|
23
23
|
|
|
24
24
|
while (++index < arrayLength) {
|
|
25
|
-
const
|
|
26
|
-
if (isPromise(
|
|
25
|
+
const resultElement = mapper(array[index], index, array)
|
|
26
|
+
if (isPromise(resultElement)) {
|
|
27
27
|
isAsync = true
|
|
28
28
|
}
|
|
29
|
-
result[index] =
|
|
29
|
+
result[index] = resultElement
|
|
30
30
|
}
|
|
31
31
|
return isAsync ? promiseAll(result) : result
|
|
32
32
|
}
|
|
@@ -14,6 +14,6 @@ export = arrayMapPool;
|
|
|
14
14
|
* ```
|
|
15
15
|
*
|
|
16
16
|
* @description
|
|
17
|
-
* Apply a mapper with limited concurrency to each
|
|
17
|
+
* Apply a mapper with limited concurrency to each element of an array, returning an array of results.
|
|
18
18
|
*/
|
|
19
19
|
declare function arrayMapPool(array: any, mapper: any, concurrentLimit: any): any[] | Promise<any>;
|
|
@@ -20,7 +20,7 @@ const promiseRace = require('./promiseRace')
|
|
|
20
20
|
* ```
|
|
21
21
|
*
|
|
22
22
|
* @description
|
|
23
|
-
* Apply a function `f` with limited concurrency to each
|
|
23
|
+
* Apply a function `f` with limited concurrency to each element of an array, returning a Promise of an array of results.
|
|
24
24
|
*/
|
|
25
25
|
const arrayMapPoolAsync = async function (
|
|
26
26
|
array, f, concurrencyLimit, result, index, promises,
|
|
@@ -30,14 +30,14 @@ const arrayMapPoolAsync = async function (
|
|
|
30
30
|
if (promises.size >= concurrencyLimit) {
|
|
31
31
|
await promiseRace(promises)
|
|
32
32
|
}
|
|
33
|
-
const
|
|
34
|
-
if (isPromise(
|
|
35
|
-
const selfDeletingPromise =
|
|
33
|
+
const resultElement = f(array[index])
|
|
34
|
+
if (isPromise(resultElement)) {
|
|
35
|
+
const selfDeletingPromise = resultElement.then(
|
|
36
36
|
tapSync(() => promises.delete(selfDeletingPromise)))
|
|
37
37
|
promises.add(selfDeletingPromise)
|
|
38
38
|
result[index] = selfDeletingPromise
|
|
39
39
|
} else {
|
|
40
|
-
result[index] =
|
|
40
|
+
result[index] = resultElement
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
return promiseAll(result)
|
|
@@ -52,24 +52,24 @@ const arrayMapPoolAsync = async function (
|
|
|
52
52
|
* ```
|
|
53
53
|
*
|
|
54
54
|
* @description
|
|
55
|
-
* Apply a function `f` with limited concurrency to each
|
|
55
|
+
* Apply a function `f` with limited concurrency to each element of an array, returning an array of results.
|
|
56
56
|
*/
|
|
57
57
|
const arrayMapPool = function (array, concurrency, f) {
|
|
58
58
|
const arrayLength = array.length,
|
|
59
59
|
result = Array(arrayLength)
|
|
60
60
|
let index = -1
|
|
61
61
|
while (++index < arrayLength) {
|
|
62
|
-
const
|
|
63
|
-
if (isPromise(
|
|
62
|
+
const resultElement = f(array[index])
|
|
63
|
+
if (isPromise(resultElement)) {
|
|
64
64
|
const promises = new Set(),
|
|
65
|
-
selfDeletingPromise =
|
|
65
|
+
selfDeletingPromise = resultElement.then(
|
|
66
66
|
tapSync(() => promises.delete(selfDeletingPromise)))
|
|
67
67
|
promises.add(selfDeletingPromise)
|
|
68
68
|
result[index] = selfDeletingPromise
|
|
69
69
|
return arrayMapPoolAsync(
|
|
70
70
|
array, f, concurrency, result, index, promises)
|
|
71
71
|
}
|
|
72
|
-
result[index] =
|
|
72
|
+
result[index] = resultElement
|
|
73
73
|
}
|
|
74
74
|
return result
|
|
75
75
|
}
|
|
@@ -28,14 +28,14 @@ const arrayMapRate = async function (array, rate, f) {
|
|
|
28
28
|
await sleep(minPeriodMs - lastExecutionTime)
|
|
29
29
|
}
|
|
30
30
|
const start = performance.now()
|
|
31
|
-
let
|
|
32
|
-
if (isPromise(
|
|
33
|
-
|
|
31
|
+
let resultElement = f(array[index], index, array)
|
|
32
|
+
if (isPromise(resultElement)) {
|
|
33
|
+
resultElement = await resultElement
|
|
34
34
|
}
|
|
35
35
|
const end = performance.now()
|
|
36
36
|
const executionTime = end - start
|
|
37
37
|
lastExecutionTime = executionTime
|
|
38
|
-
result[index] =
|
|
38
|
+
result[index] = resultElement
|
|
39
39
|
}
|
|
40
40
|
const totalEnd = performance.now()
|
|
41
41
|
return result
|
|
@@ -12,6 +12,6 @@ export = arrayMapSeries;
|
|
|
12
12
|
* ```
|
|
13
13
|
*
|
|
14
14
|
* @description
|
|
15
|
-
* Apply a mapper in series to each
|
|
15
|
+
* Apply a mapper in series to each element of an array, returning an array of results.
|
|
16
16
|
*/
|
|
17
17
|
declare function arrayMapSeries(array: any, mapper: any): any;
|
|
@@ -20,15 +20,15 @@ const objectSet = require('./objectSet')
|
|
|
20
20
|
* ```
|
|
21
21
|
*
|
|
22
22
|
* @description
|
|
23
|
-
* Apply a mapper in series to each
|
|
23
|
+
* Apply a mapper in series to each element of an array, returning a Promise of an array of results. `mapper` can be asynchronous.
|
|
24
24
|
*/
|
|
25
25
|
const arrayMapSeriesAsync = async function (
|
|
26
26
|
array, mapper, result, index,
|
|
27
27
|
) {
|
|
28
28
|
const arrayLength = array.length
|
|
29
29
|
while (++index < arrayLength) {
|
|
30
|
-
const
|
|
31
|
-
result[index] = isPromise(
|
|
30
|
+
const resultElement = mapper(array[index], index)
|
|
31
|
+
result[index] = isPromise(resultElement) ? await resultElement : resultElement
|
|
32
32
|
}
|
|
33
33
|
return result
|
|
34
34
|
}
|
|
@@ -46,7 +46,7 @@ const arrayMapSeriesAsync = async function (
|
|
|
46
46
|
* ```
|
|
47
47
|
*
|
|
48
48
|
* @description
|
|
49
|
-
* Apply a mapper in series to each
|
|
49
|
+
* Apply a mapper in series to each element of an array, returning an array of results.
|
|
50
50
|
*/
|
|
51
51
|
const arrayMapSeries = function (array, mapper) {
|
|
52
52
|
const arrayLength = array.length,
|
|
@@ -54,13 +54,13 @@ const arrayMapSeries = function (array, mapper) {
|
|
|
54
54
|
let index = -1
|
|
55
55
|
|
|
56
56
|
while (++index < arrayLength) {
|
|
57
|
-
const
|
|
58
|
-
if (isPromise(
|
|
59
|
-
return
|
|
57
|
+
const resultElement = mapper(array[index], index)
|
|
58
|
+
if (isPromise(resultElement)) {
|
|
59
|
+
return resultElement.then(funcConcat(
|
|
60
60
|
curry3(objectSet, result, index, __),
|
|
61
61
|
curry4(arrayMapSeriesAsync, array, mapper, __, index)))
|
|
62
62
|
}
|
|
63
|
-
result[index] =
|
|
63
|
+
result[index] = resultElement
|
|
64
64
|
}
|
|
65
65
|
return result
|
|
66
66
|
}
|
|
@@ -15,18 +15,18 @@ const promiseAll = require('./promiseAll')
|
|
|
15
15
|
* ```
|
|
16
16
|
*
|
|
17
17
|
* @description
|
|
18
|
-
* Apply an indexed mapper to each
|
|
18
|
+
* Apply an indexed mapper to each element of an array, returning an array of results.
|
|
19
19
|
*/
|
|
20
20
|
const arrayMapWithIndex = function (array, mapper) {
|
|
21
21
|
const arrayLength = array.length,
|
|
22
22
|
result = Array(arrayLength)
|
|
23
23
|
let index = -1, isAsync = false
|
|
24
24
|
while (++index < arrayLength) {
|
|
25
|
-
const
|
|
26
|
-
if (isPromise(
|
|
25
|
+
const resultElement = mapper(array[index], index, array)
|
|
26
|
+
if (isPromise(resultElement)) {
|
|
27
27
|
isAsync = true
|
|
28
28
|
}
|
|
29
|
-
result[index] =
|
|
29
|
+
result[index] = resultElement
|
|
30
30
|
}
|
|
31
31
|
return isAsync ? promiseAll(result) : result
|
|
32
32
|
}
|
package/_internal/arrayReduce.js
CHANGED
|
@@ -16,7 +16,7 @@ const curry4 = require('./curry4')
|
|
|
16
16
|
* ```
|
|
17
17
|
*
|
|
18
18
|
* @description
|
|
19
|
-
* Execute a reducer for each
|
|
19
|
+
* Execute a reducer for each element of an array, returning a Promise of a single value.
|
|
20
20
|
*/
|
|
21
21
|
const arrayReduceAsync = async function (
|
|
22
22
|
array, reducer, result, index,
|
|
@@ -15,15 +15,15 @@ const always = require('./always')
|
|
|
15
15
|
* ```
|
|
16
16
|
*
|
|
17
17
|
* @description
|
|
18
|
-
* Create an async generator executor that executes a callback for each
|
|
18
|
+
* Create an async generator executor that executes a callback for each element of an async generator generated by an async generator function.
|
|
19
19
|
*/
|
|
20
20
|
const asyncGeneratorFunctionForEach = (
|
|
21
21
|
asyncGeneratorFunction, callback,
|
|
22
22
|
) => async function* executingCallbackForEach(...args) {
|
|
23
23
|
const promises = [],
|
|
24
24
|
asyncIterator = asyncGeneratorFunction(...args)
|
|
25
|
-
for await (const
|
|
26
|
-
const operation = callback(
|
|
25
|
+
for await (const element of asyncIterator) {
|
|
26
|
+
const operation = callback(element)
|
|
27
27
|
if (isPromise(operation)) {
|
|
28
28
|
promises.push(operation)
|
|
29
29
|
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* ```
|
|
14
14
|
*
|
|
15
15
|
* @description
|
|
16
|
-
* Create a mapping async generator function from an async generator function and a mapper. A mapping async generator function produces async mapping generators that apply the mapper to each
|
|
16
|
+
* Create a mapping async generator function from an async generator function and a mapper. A mapping async generator function produces async mapping generators that apply the mapper to each element of the original async generator.
|
|
17
17
|
*
|
|
18
18
|
* `mapper` may be asynchronous.
|
|
19
19
|
*
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
*/
|
|
22
22
|
const asyncGeneratorFunctionMap = function (asyncGeneratorFunc, mapper) {
|
|
23
23
|
return async function* mappingAsyncGeneratorFunc(...args) {
|
|
24
|
-
for await (const
|
|
25
|
-
yield mapper(
|
|
24
|
+
for await (const element of asyncGeneratorFunc(...args)) {
|
|
25
|
+
yield mapper(element)
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -13,13 +13,13 @@ const isPromise = require('./isPromise')
|
|
|
13
13
|
const asyncIteratorFind = async function (asyncIterator, predicate) {
|
|
14
14
|
let iteration = await asyncIterator.next()
|
|
15
15
|
while (!iteration.done) {
|
|
16
|
-
const
|
|
17
|
-
let predication = predicate(
|
|
16
|
+
const element = iteration.value
|
|
17
|
+
let predication = predicate(element)
|
|
18
18
|
if (isPromise(predication)) {
|
|
19
19
|
predication = await predication
|
|
20
20
|
}
|
|
21
21
|
if (predication) {
|
|
22
|
-
return
|
|
22
|
+
return element
|
|
23
23
|
}
|
|
24
24
|
iteration = await asyncIterator.next()
|
|
25
25
|
}
|
|
@@ -12,6 +12,6 @@ export = asyncIteratorForEach;
|
|
|
12
12
|
* ```
|
|
13
13
|
*
|
|
14
14
|
* @description
|
|
15
|
-
* Execute a callback function for each
|
|
15
|
+
* Execute a callback function for each element of an async iterator
|
|
16
16
|
*/
|
|
17
17
|
declare function asyncIteratorForEach(asyncIterator: any, callback: any): Promise<any>;
|
|
@@ -15,12 +15,12 @@ const always = require('./always')
|
|
|
15
15
|
* ```
|
|
16
16
|
*
|
|
17
17
|
* @description
|
|
18
|
-
* Execute a callback function for each
|
|
18
|
+
* Execute a callback function for each element of an async iterator
|
|
19
19
|
*/
|
|
20
20
|
const asyncIteratorForEach = async function (asyncIterator, callback) {
|
|
21
21
|
const promises = []
|
|
22
|
-
for await (const
|
|
23
|
-
const operation = callback(
|
|
22
|
+
for await (const element of asyncIterator) {
|
|
23
|
+
const operation = callback(element)
|
|
24
24
|
if (isPromise(operation)) {
|
|
25
25
|
promises.push(operation)
|
|
26
26
|
}
|
|
@@ -13,11 +13,11 @@ const isPromise = require('./isPromise')
|
|
|
13
13
|
* ```
|
|
14
14
|
*
|
|
15
15
|
* @description
|
|
16
|
-
* Execute a callback function for each
|
|
16
|
+
* Execute a callback function for each element of an async iterator in series.
|
|
17
17
|
*/
|
|
18
18
|
const asyncIteratorForEachSeries = async function (asyncIterator, callback) {
|
|
19
|
-
for await (const
|
|
20
|
-
const operation = callback(
|
|
19
|
+
for await (const element of asyncIterator) {
|
|
20
|
+
const operation = callback(element)
|
|
21
21
|
if (isPromise(operation)) {
|
|
22
22
|
await operation
|
|
23
23
|
}
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
*/
|
|
17
17
|
const asyncIteratorToArray = async function (asyncIterator) {
|
|
18
18
|
const result = []
|
|
19
|
-
for await (const
|
|
20
|
-
result.push(
|
|
19
|
+
for await (const element of asyncIterator) {
|
|
20
|
+
result.push(element)
|
|
21
21
|
}
|
|
22
22
|
return result
|
|
23
23
|
}
|
package/_internal/copyDeep.js
CHANGED
|
@@ -4,13 +4,13 @@ const isArray = require('./isArray')
|
|
|
4
4
|
const objectCopyDeep = function (object) {
|
|
5
5
|
const result = {}
|
|
6
6
|
for (const key in object) {
|
|
7
|
-
const
|
|
8
|
-
if (isArray(
|
|
9
|
-
result[key] = arrayCopyDeep(
|
|
10
|
-
} else if (
|
|
11
|
-
result[key] = objectCopyDeep(
|
|
7
|
+
const element = object[key]
|
|
8
|
+
if (isArray(element)) {
|
|
9
|
+
result[key] = arrayCopyDeep(element)
|
|
10
|
+
} else if (element != null && element.constructor == Object) {
|
|
11
|
+
result[key] = objectCopyDeep(element)
|
|
12
12
|
} else {
|
|
13
|
-
result[key] =
|
|
13
|
+
result[key] = element
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
return result
|
|
@@ -22,13 +22,13 @@ const arrayCopyDeep = function (array) {
|
|
|
22
22
|
result = []
|
|
23
23
|
let index = -1
|
|
24
24
|
while (++index < length) {
|
|
25
|
-
const
|
|
26
|
-
if (isArray(
|
|
27
|
-
result[index] = arrayCopyDeep(
|
|
28
|
-
} else if (
|
|
29
|
-
result[index] = objectCopyDeep(
|
|
25
|
+
const element = array[index]
|
|
26
|
+
if (isArray(element)) {
|
|
27
|
+
result[index] = arrayCopyDeep(element)
|
|
28
|
+
} else if (element != null && element.constructor == Object) {
|
|
29
|
+
result[index] = objectCopyDeep(element)
|
|
30
30
|
} else {
|
|
31
|
-
result[index] =
|
|
31
|
+
result[index] = element
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
return result
|
package/_internal/funcAll.js
CHANGED
|
@@ -16,11 +16,11 @@ const funcAll = funcs => function allFuncs(...args) {
|
|
|
16
16
|
result = Array(funcsLength)
|
|
17
17
|
let funcsIndex = -1, isAsync = false
|
|
18
18
|
while (++funcsIndex < funcsLength) {
|
|
19
|
-
const
|
|
20
|
-
if (isPromise(
|
|
19
|
+
const resultElement = funcs[funcsIndex](...args)
|
|
20
|
+
if (isPromise(resultElement)) {
|
|
21
21
|
isAsync = true
|
|
22
22
|
}
|
|
23
|
-
result[funcsIndex] =
|
|
23
|
+
result[funcsIndex] = resultElement
|
|
24
24
|
}
|
|
25
25
|
return isAsync ? promiseAll(result) : result
|
|
26
26
|
}
|
|
@@ -23,8 +23,8 @@ const objectSet = require('./objectSet')
|
|
|
23
23
|
const asyncFuncAllSeries = async function (funcs, args, result, funcsIndex) {
|
|
24
24
|
const funcsLength = funcs.length
|
|
25
25
|
while (++funcsIndex < funcsLength) {
|
|
26
|
-
const
|
|
27
|
-
result[funcsIndex] = isPromise(
|
|
26
|
+
const resultElement = funcs[funcsIndex](...args)
|
|
27
|
+
result[funcsIndex] = isPromise(resultElement) ? await resultElement : resultElement
|
|
28
28
|
}
|
|
29
29
|
return result
|
|
30
30
|
}
|
|
@@ -43,13 +43,13 @@ const funcAllSeries = funcs => function allFuncsSeries(...args) {
|
|
|
43
43
|
const funcsLength = funcs.length, result = []
|
|
44
44
|
let funcsIndex = -1
|
|
45
45
|
while (++funcsIndex < funcsLength) {
|
|
46
|
-
const
|
|
47
|
-
if (isPromise(
|
|
48
|
-
return
|
|
46
|
+
const resultElement = funcs[funcsIndex](...args)
|
|
47
|
+
if (isPromise(resultElement)) {
|
|
48
|
+
return resultElement.then(funcConcat(
|
|
49
49
|
curry3(objectSet, result, funcsIndex, __),
|
|
50
50
|
curry4(asyncFuncAllSeries, funcs, args, __, funcsIndex)))
|
|
51
51
|
}
|
|
52
|
-
result[funcsIndex] =
|
|
52
|
+
result[funcsIndex] = resultElement
|
|
53
53
|
}
|
|
54
54
|
return result
|
|
55
55
|
}
|
|
@@ -21,11 +21,11 @@ const objectSet = require('./objectSet')
|
|
|
21
21
|
const funcObjectAll = funcs => function objectAllFuncs(...args) {
|
|
22
22
|
const result = {}, promises = []
|
|
23
23
|
for (const key in funcs) {
|
|
24
|
-
const
|
|
25
|
-
if (isPromise(
|
|
26
|
-
promises.push(
|
|
24
|
+
const resultElement = funcs[key](...args)
|
|
25
|
+
if (isPromise(resultElement)) {
|
|
26
|
+
promises.push(resultElement.then(curry3(objectSet, result, key, __)))
|
|
27
27
|
} else {
|
|
28
|
-
result[key] =
|
|
28
|
+
result[key] = resultElement
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
return promises.length == 0 ? result : promiseAll(promises).then(always(result))
|
|
@@ -15,11 +15,11 @@ const functionArrayAll = function (funcs, args) {
|
|
|
15
15
|
let funcsIndex = -1, isAsync = false
|
|
16
16
|
while (++funcsIndex < funcsLength) {
|
|
17
17
|
const f = funcs[funcsIndex]
|
|
18
|
-
const
|
|
19
|
-
if (isPromise(
|
|
18
|
+
const resultElement = typeof f == 'function' ? f(...args) : f
|
|
19
|
+
if (isPromise(resultElement)) {
|
|
20
20
|
isAsync = true
|
|
21
21
|
}
|
|
22
|
-
result[funcsIndex] =
|
|
22
|
+
result[funcsIndex] = resultElement
|
|
23
23
|
}
|
|
24
24
|
return isAsync ? promiseAll(result) : result
|
|
25
25
|
}
|
|
@@ -23,8 +23,8 @@ const objectSet = require('./objectSet')
|
|
|
23
23
|
const asyncFunctionArrayAllSeries = async function (funcs, args, result, funcsIndex) {
|
|
24
24
|
const funcsLength = funcs.length
|
|
25
25
|
while (++funcsIndex < funcsLength) {
|
|
26
|
-
const
|
|
27
|
-
result[funcsIndex] = isPromise(
|
|
26
|
+
const resultElement = funcs[funcsIndex](...args)
|
|
27
|
+
result[funcsIndex] = isPromise(resultElement) ? await resultElement : resultElement
|
|
28
28
|
}
|
|
29
29
|
return result
|
|
30
30
|
}
|
|
@@ -41,13 +41,13 @@ const functionArrayAllSeries = function (funcs, args) {
|
|
|
41
41
|
const funcsLength = funcs.length, result = []
|
|
42
42
|
let funcsIndex = -1
|
|
43
43
|
while (++funcsIndex < funcsLength) {
|
|
44
|
-
const
|
|
45
|
-
if (isPromise(
|
|
46
|
-
return
|
|
44
|
+
const resultElement = funcs[funcsIndex](...args)
|
|
45
|
+
if (isPromise(resultElement)) {
|
|
46
|
+
return resultElement.then(funcConcat(
|
|
47
47
|
curry3(objectSet, result, funcsIndex, __),
|
|
48
48
|
curry4(asyncFunctionArrayAllSeries, funcs, args, __, funcsIndex)))
|
|
49
49
|
}
|
|
50
|
-
result[funcsIndex] =
|
|
50
|
+
result[funcsIndex] = resultElement
|
|
51
51
|
}
|
|
52
52
|
return result
|
|
53
53
|
}
|
|
@@ -20,11 +20,11 @@ const functionObjectAll = function (funcs, args) {
|
|
|
20
20
|
const result = {}, promises = []
|
|
21
21
|
for (const key in funcs) {
|
|
22
22
|
const f = funcs[key]
|
|
23
|
-
const
|
|
24
|
-
if (isPromise(
|
|
25
|
-
promises.push(
|
|
23
|
+
const resultElement = typeof f == 'function' ? f(...args) : f
|
|
24
|
+
if (isPromise(resultElement)) {
|
|
25
|
+
promises.push(resultElement.then(curry3(objectSet, result, key, __)))
|
|
26
26
|
} else {
|
|
27
|
-
result[key] =
|
|
27
|
+
result[key] = resultElement
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
return promises.length == 0 ? result : promiseAll(promises).then(always(result))
|
|
@@ -15,15 +15,15 @@ const always = require('./always')
|
|
|
15
15
|
* ```
|
|
16
16
|
*
|
|
17
17
|
* @description
|
|
18
|
-
* Create a generator executor that executes a callback for each
|
|
18
|
+
* Create a generator executor that executes a callback for each element of a generator generated by a generator function. The executor may return a promise if any execution is asynchronous.
|
|
19
19
|
*/
|
|
20
20
|
const generatorFunctionForEach = (
|
|
21
21
|
generatorFunction, callback,
|
|
22
22
|
) => function* executingCallbackForEach(...args) {
|
|
23
23
|
const promises = [],
|
|
24
24
|
generator = generatorFunction(...args)
|
|
25
|
-
for (const
|
|
26
|
-
const operation = callback(
|
|
25
|
+
for (const element of generator) {
|
|
26
|
+
const operation = callback(element)
|
|
27
27
|
if (isPromise(operation)) {
|
|
28
28
|
promises.push(operation)
|
|
29
29
|
}
|
|
@@ -12,15 +12,15 @@
|
|
|
12
12
|
* ```
|
|
13
13
|
*
|
|
14
14
|
* @description
|
|
15
|
-
* Create a mapping generator function from a generator function and a mapper. A mapping generator function produces mapping generators that apply the mapper to each
|
|
15
|
+
* Create a mapping generator function from a generator function and a mapper. A mapping generator function produces mapping generators that apply the mapper to each element of the original generator.
|
|
16
16
|
*
|
|
17
17
|
* @TODO playground example
|
|
18
18
|
*/
|
|
19
19
|
const generatorFunctionMap = (
|
|
20
20
|
generatorFunc, mapper,
|
|
21
21
|
) => function* mappingGeneratorFunc(...args) {
|
|
22
|
-
for (const
|
|
23
|
-
yield mapper(
|
|
22
|
+
for (const element of generatorFunc(...args)) {
|
|
23
|
+
yield mapper(element)
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -19,7 +19,7 @@ const iteratorReduce = require('./iteratorReduce')
|
|
|
19
19
|
* ```
|
|
20
20
|
*
|
|
21
21
|
* @description
|
|
22
|
-
* Execute a reducer for each
|
|
22
|
+
* Execute a reducer for each element of a generator function, returning a single value.
|
|
23
23
|
*/
|
|
24
24
|
const generatorFunctionReduce = (
|
|
25
25
|
generatorFunction, reducer, result,
|
|
@@ -16,8 +16,8 @@ const callPropUnary = require('./callPropUnary')
|
|
|
16
16
|
*/
|
|
17
17
|
const iteratorEvery = function (iterator, predicate) {
|
|
18
18
|
const promises = []
|
|
19
|
-
for (const
|
|
20
|
-
const predication = predicate(
|
|
19
|
+
for (const element of iterator) {
|
|
20
|
+
const predication = predicate(element)
|
|
21
21
|
if (isPromise(predication)) {
|
|
22
22
|
promises.push(predication)
|
|
23
23
|
} else if (!predication) {
|
|
@@ -18,13 +18,13 @@ const always = require('./always')
|
|
|
18
18
|
const iteratorFindAsync = async function (iterator, predicate) {
|
|
19
19
|
let iteration = iterator.next()
|
|
20
20
|
while (!iteration.done) {
|
|
21
|
-
const
|
|
22
|
-
let predication = predicate(
|
|
21
|
+
const element = iteration.value
|
|
22
|
+
let predication = predicate(element)
|
|
23
23
|
if (isPromise(predication)) {
|
|
24
24
|
predication = await predication
|
|
25
25
|
}
|
|
26
26
|
if (predication) {
|
|
27
|
-
return
|
|
27
|
+
return element
|
|
28
28
|
}
|
|
29
29
|
iteration = iterator.next()
|
|
30
30
|
}
|
|
@@ -44,16 +44,16 @@ const iteratorFindAsync = async function (iterator, predicate) {
|
|
|
44
44
|
const iteratorFind = function (iterator, predicate) {
|
|
45
45
|
let iteration = iterator.next()
|
|
46
46
|
while (!iteration.done) {
|
|
47
|
-
const
|
|
48
|
-
predication = predicate(
|
|
47
|
+
const element = iteration.value,
|
|
48
|
+
predication = predicate(element)
|
|
49
49
|
if (isPromise(predication)) {
|
|
50
50
|
return predication.then(curry3(
|
|
51
51
|
thunkConditional,
|
|
52
52
|
__,
|
|
53
|
-
always(
|
|
53
|
+
always(element),
|
|
54
54
|
thunkify2(iteratorFindAsync, iterator, predicate)))
|
|
55
55
|
} else if (predication) {
|
|
56
|
-
return
|
|
56
|
+
return element
|
|
57
57
|
}
|
|
58
58
|
iteration = iterator.next()
|
|
59
59
|
}
|
|
@@ -12,7 +12,7 @@ export = iteratorForEach;
|
|
|
12
12
|
* ```
|
|
13
13
|
*
|
|
14
14
|
* @description
|
|
15
|
-
* Call a callback for each
|
|
15
|
+
* Call a callback for each element of an iterator. Return a promise if any executions are asynchronous.
|
|
16
16
|
*
|
|
17
17
|
* Note: iterator is consumed
|
|
18
18
|
*/
|
|
@@ -15,14 +15,14 @@ const always = require('./always')
|
|
|
15
15
|
* ```
|
|
16
16
|
*
|
|
17
17
|
* @description
|
|
18
|
-
* Call a callback for each
|
|
18
|
+
* Call a callback for each element of an iterator. Return a promise if any executions are asynchronous.
|
|
19
19
|
*
|
|
20
20
|
* Note: iterator is consumed
|
|
21
21
|
*/
|
|
22
22
|
const iteratorForEach = function (iterator, callback) {
|
|
23
23
|
const promises = []
|
|
24
|
-
for (const
|
|
25
|
-
const operation = callback(
|
|
24
|
+
for (const element of iterator) {
|
|
25
|
+
const operation = callback(element)
|
|
26
26
|
if (isPromise(operation)) {
|
|
27
27
|
promises.push(operation)
|
|
28
28
|
}
|
|
@@ -26,7 +26,7 @@ const _iteratorForEachSeriesAsync = async function (iterator, callback) {
|
|
|
26
26
|
* ```
|
|
27
27
|
*
|
|
28
28
|
* @description
|
|
29
|
-
* Call a callback for each
|
|
29
|
+
* Call a callback for each element of an iterator. Return a promise if any executions are asynchronous.
|
|
30
30
|
*
|
|
31
31
|
* Note: iterator is consumed
|
|
32
32
|
*/
|