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/es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.7.
|
|
2
|
+
* rubico v2.7.4
|
|
3
3
|
* https://github.com/a-synchronous/rubico
|
|
4
4
|
* (c) 2019-2025 Richard Tong
|
|
5
5
|
* rubico may be freely distributed under the MIT license.
|
|
@@ -299,11 +299,11 @@ const functionArrayAll = function (funcs, args) {
|
|
|
299
299
|
let funcsIndex = -1, isAsync = false
|
|
300
300
|
while (++funcsIndex < funcsLength) {
|
|
301
301
|
const f = funcs[funcsIndex]
|
|
302
|
-
const
|
|
303
|
-
if (isPromise(
|
|
302
|
+
const resultElement = typeof f == 'function' ? f(...args) : f
|
|
303
|
+
if (isPromise(resultElement)) {
|
|
304
304
|
isAsync = true
|
|
305
305
|
}
|
|
306
|
-
result[funcsIndex] =
|
|
306
|
+
result[funcsIndex] = resultElement
|
|
307
307
|
}
|
|
308
308
|
return isAsync ? promiseAll(result) : result
|
|
309
309
|
}
|
|
@@ -357,8 +357,8 @@ const objectSet = function (object, property, value) {
|
|
|
357
357
|
const asyncFunctionArrayAllSeries = async function (funcs, args, result, funcsIndex) {
|
|
358
358
|
const funcsLength = funcs.length
|
|
359
359
|
while (++funcsIndex < funcsLength) {
|
|
360
|
-
const
|
|
361
|
-
result[funcsIndex] = isPromise(
|
|
360
|
+
const resultElement = funcs[funcsIndex](...args)
|
|
361
|
+
result[funcsIndex] = isPromise(resultElement) ? await resultElement : resultElement
|
|
362
362
|
}
|
|
363
363
|
return result
|
|
364
364
|
}
|
|
@@ -367,13 +367,13 @@ const functionArrayAllSeries = function (funcs, args) {
|
|
|
367
367
|
const funcsLength = funcs.length, result = []
|
|
368
368
|
let funcsIndex = -1
|
|
369
369
|
while (++funcsIndex < funcsLength) {
|
|
370
|
-
const
|
|
371
|
-
if (isPromise(
|
|
372
|
-
return
|
|
370
|
+
const resultElement = funcs[funcsIndex](...args)
|
|
371
|
+
if (isPromise(resultElement)) {
|
|
372
|
+
return resultElement.then(funcConcat(
|
|
373
373
|
curry3(objectSet, result, funcsIndex, __),
|
|
374
374
|
curry4(asyncFunctionArrayAllSeries, funcs, args, __, funcsIndex)))
|
|
375
375
|
}
|
|
376
|
-
result[funcsIndex] =
|
|
376
|
+
result[funcsIndex] = resultElement
|
|
377
377
|
}
|
|
378
378
|
return result
|
|
379
379
|
}
|
|
@@ -382,11 +382,11 @@ const functionObjectAll = function (funcs, args) {
|
|
|
382
382
|
const result = {}, promises = []
|
|
383
383
|
for (const key in funcs) {
|
|
384
384
|
const f = funcs[key]
|
|
385
|
-
const
|
|
386
|
-
if (isPromise(
|
|
387
|
-
promises.push(
|
|
385
|
+
const resultElement = typeof f == 'function' ? f(...args) : f
|
|
386
|
+
if (isPromise(resultElement)) {
|
|
387
|
+
promises.push(resultElement.then(curry3(objectSet, result, key, __)))
|
|
388
388
|
} else {
|
|
389
|
-
result[key] =
|
|
389
|
+
result[key] = resultElement
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
392
|
return promises.length == 0 ? result : promiseAll(promises).then(always(result))
|
|
@@ -636,11 +636,11 @@ const arrayMap = function (array, mapper) {
|
|
|
636
636
|
isAsync = false
|
|
637
637
|
|
|
638
638
|
while (++index < arrayLength) {
|
|
639
|
-
const
|
|
640
|
-
if (isPromise(
|
|
639
|
+
const resultElement = mapper(array[index], index, array)
|
|
640
|
+
if (isPromise(resultElement)) {
|
|
641
641
|
isAsync = true
|
|
642
642
|
}
|
|
643
|
-
result[index] =
|
|
643
|
+
result[index] = resultElement
|
|
644
644
|
}
|
|
645
645
|
return isAsync ? promiseAll(result) : result
|
|
646
646
|
}
|
|
@@ -657,12 +657,12 @@ const stringMap = function (string, mapper) {
|
|
|
657
657
|
const setMap = function (set, mapper) {
|
|
658
658
|
const result = new Set(),
|
|
659
659
|
promises = []
|
|
660
|
-
for (const
|
|
661
|
-
const
|
|
662
|
-
if (isPromise(
|
|
663
|
-
promises.push(
|
|
660
|
+
for (const element of set) {
|
|
661
|
+
const resultElement = mapper(element, element, set)
|
|
662
|
+
if (isPromise(resultElement)) {
|
|
663
|
+
promises.push(resultElement.then(curry3(callPropUnary, result, 'add', __)))
|
|
664
664
|
} else {
|
|
665
|
-
result.add(
|
|
665
|
+
result.add(resultElement)
|
|
666
666
|
}
|
|
667
667
|
}
|
|
668
668
|
return promises.length == 0
|
|
@@ -675,13 +675,13 @@ const callPropBinary = (value, property, arg0, arg1) => value[property](arg0, ar
|
|
|
675
675
|
const mapMap = function (value, mapper) {
|
|
676
676
|
const result = new Map(),
|
|
677
677
|
promises = []
|
|
678
|
-
for (const [key,
|
|
679
|
-
const
|
|
680
|
-
if (isPromise(
|
|
681
|
-
promises.push(
|
|
678
|
+
for (const [key, element] of value) {
|
|
679
|
+
const resultElement = mapper(element, key, value)
|
|
680
|
+
if (isPromise(resultElement)) {
|
|
681
|
+
promises.push(resultElement.then(
|
|
682
682
|
curry4(callPropBinary, result, 'set', key, __)))
|
|
683
683
|
} else {
|
|
684
|
-
result.set(key,
|
|
684
|
+
result.set(key, resultElement)
|
|
685
685
|
}
|
|
686
686
|
}
|
|
687
687
|
return promises.length == 0
|
|
@@ -693,11 +693,11 @@ const objectMap = function (object, mapper) {
|
|
|
693
693
|
const result = {}
|
|
694
694
|
let isAsync = false
|
|
695
695
|
for (const key in object) {
|
|
696
|
-
const
|
|
697
|
-
if (isPromise(
|
|
696
|
+
const resultElement = mapper(object[key], key, object)
|
|
697
|
+
if (isPromise(resultElement)) {
|
|
698
698
|
isAsync = true
|
|
699
699
|
}
|
|
700
|
-
result[key] =
|
|
700
|
+
result[key] = resultElement
|
|
701
701
|
}
|
|
702
702
|
return isAsync ? promiseObjectAll(result) : result
|
|
703
703
|
}
|
|
@@ -707,8 +707,8 @@ const arrayMapSeriesAsync = async function (
|
|
|
707
707
|
) {
|
|
708
708
|
const arrayLength = array.length
|
|
709
709
|
while (++index < arrayLength) {
|
|
710
|
-
const
|
|
711
|
-
result[index] = isPromise(
|
|
710
|
+
const resultElement = mapper(array[index], index)
|
|
711
|
+
result[index] = isPromise(resultElement) ? await resultElement : resultElement
|
|
712
712
|
}
|
|
713
713
|
return result
|
|
714
714
|
}
|
|
@@ -719,13 +719,13 @@ const arrayMapSeries = function (array, mapper) {
|
|
|
719
719
|
let index = -1
|
|
720
720
|
|
|
721
721
|
while (++index < arrayLength) {
|
|
722
|
-
const
|
|
723
|
-
if (isPromise(
|
|
724
|
-
return
|
|
722
|
+
const resultElement = mapper(array[index], index)
|
|
723
|
+
if (isPromise(resultElement)) {
|
|
724
|
+
return resultElement.then(funcConcat(
|
|
725
725
|
curry3(objectSet, result, index, __),
|
|
726
726
|
curry4(arrayMapSeriesAsync, array, mapper, __, index)))
|
|
727
727
|
}
|
|
728
|
-
result[index] =
|
|
728
|
+
result[index] = resultElement
|
|
729
729
|
}
|
|
730
730
|
return result
|
|
731
731
|
}
|
|
@@ -752,11 +752,11 @@ const _objectMapSeriesAsync = async function (object, f, result, doneKeys) {
|
|
|
752
752
|
if (key in doneKeys) {
|
|
753
753
|
continue
|
|
754
754
|
}
|
|
755
|
-
let
|
|
756
|
-
if (isPromise(
|
|
757
|
-
|
|
755
|
+
let resultElement = f(object[key])
|
|
756
|
+
if (isPromise(resultElement)) {
|
|
757
|
+
resultElement = await resultElement
|
|
758
758
|
}
|
|
759
|
-
result[key] =
|
|
759
|
+
result[key] = resultElement
|
|
760
760
|
}
|
|
761
761
|
return result
|
|
762
762
|
}
|
|
@@ -766,14 +766,14 @@ const objectMapSeries = function (object, f) {
|
|
|
766
766
|
const doneKeys = {}
|
|
767
767
|
for (const key in object) {
|
|
768
768
|
doneKeys[key] = true
|
|
769
|
-
const
|
|
770
|
-
if (isPromise(
|
|
771
|
-
return
|
|
769
|
+
const resultElement = f(object[key], key, object)
|
|
770
|
+
if (isPromise(resultElement)) {
|
|
771
|
+
return resultElement.then(funcConcat(
|
|
772
772
|
curry3(objectSet, result, key, __),
|
|
773
773
|
thunkify4(_objectMapSeriesAsync, object, f, result, doneKeys),
|
|
774
774
|
))
|
|
775
775
|
}
|
|
776
|
-
result[key] =
|
|
776
|
+
result[key] = resultElement
|
|
777
777
|
}
|
|
778
778
|
return result
|
|
779
779
|
}
|
|
@@ -791,11 +791,11 @@ const setAdd = function (set, value) {
|
|
|
791
791
|
const _setMapSeriesAsync = async function (iterator, f, result) {
|
|
792
792
|
let iteration = iterator.next()
|
|
793
793
|
while (!iteration.done) {
|
|
794
|
-
let
|
|
795
|
-
if (isPromise(
|
|
796
|
-
|
|
794
|
+
let resultElement = f(iteration.value)
|
|
795
|
+
if (isPromise(resultElement)) {
|
|
796
|
+
resultElement = await resultElement
|
|
797
797
|
}
|
|
798
|
-
result.add(
|
|
798
|
+
result.add(resultElement)
|
|
799
799
|
iteration = iterator.next()
|
|
800
800
|
}
|
|
801
801
|
return result
|
|
@@ -806,14 +806,14 @@ const setMapSeries = function (set, f) {
|
|
|
806
806
|
const iterator = set[symbolIterator]()
|
|
807
807
|
let iteration = iterator.next()
|
|
808
808
|
while (!iteration.done) {
|
|
809
|
-
const
|
|
810
|
-
if (isPromise(
|
|
811
|
-
return
|
|
809
|
+
const resultElement = f(iteration.value)
|
|
810
|
+
if (isPromise(resultElement)) {
|
|
811
|
+
return resultElement.then(funcConcat(
|
|
812
812
|
curry2(setAdd, result, __),
|
|
813
813
|
thunkify3(_setMapSeriesAsync, iterator, f, result),
|
|
814
814
|
))
|
|
815
815
|
}
|
|
816
|
-
result.add(
|
|
816
|
+
result.add(resultElement)
|
|
817
817
|
iteration = iterator.next()
|
|
818
818
|
}
|
|
819
819
|
return result
|
|
@@ -831,11 +831,11 @@ const mapSet = function setting(source, key, value) {
|
|
|
831
831
|
const _mapMapSeriesAsync = async function (iterator, f, result) {
|
|
832
832
|
let iteration = iterator.next()
|
|
833
833
|
while (!iteration.done) {
|
|
834
|
-
let
|
|
835
|
-
if (isPromise(
|
|
836
|
-
|
|
834
|
+
let resultElement = f(iteration.value[1])
|
|
835
|
+
if (isPromise(resultElement)) {
|
|
836
|
+
resultElement = await resultElement
|
|
837
837
|
}
|
|
838
|
-
result.set(iteration.value[0],
|
|
838
|
+
result.set(iteration.value[0], resultElement)
|
|
839
839
|
iteration = iterator.next()
|
|
840
840
|
}
|
|
841
841
|
return result
|
|
@@ -847,14 +847,14 @@ const mapMapSeries = function (map, f) {
|
|
|
847
847
|
let iteration = iterator.next()
|
|
848
848
|
while (!iteration.done) {
|
|
849
849
|
const key = iteration.value[0]
|
|
850
|
-
const
|
|
851
|
-
if (isPromise(
|
|
852
|
-
return
|
|
850
|
+
const resultElement = f(iteration.value[1])
|
|
851
|
+
if (isPromise(resultElement)) {
|
|
852
|
+
return resultElement.then(funcConcat(
|
|
853
853
|
curry3(mapSet, result, key, __),
|
|
854
854
|
thunkify3(_mapMapSeriesAsync, iterator, f, result),
|
|
855
855
|
))
|
|
856
856
|
}
|
|
857
|
-
result.set(key,
|
|
857
|
+
result.set(key, resultElement)
|
|
858
858
|
iteration = iterator.next()
|
|
859
859
|
}
|
|
860
860
|
return result
|
|
@@ -875,14 +875,14 @@ const arrayMapPoolAsync = async function (
|
|
|
875
875
|
if (promises.size >= concurrencyLimit) {
|
|
876
876
|
await promiseRace(promises)
|
|
877
877
|
}
|
|
878
|
-
const
|
|
879
|
-
if (isPromise(
|
|
880
|
-
const selfDeletingPromise =
|
|
878
|
+
const resultElement = f(array[index])
|
|
879
|
+
if (isPromise(resultElement)) {
|
|
880
|
+
const selfDeletingPromise = resultElement.then(
|
|
881
881
|
tapSync(() => promises.delete(selfDeletingPromise)))
|
|
882
882
|
promises.add(selfDeletingPromise)
|
|
883
883
|
result[index] = selfDeletingPromise
|
|
884
884
|
} else {
|
|
885
|
-
result[index] =
|
|
885
|
+
result[index] = resultElement
|
|
886
886
|
}
|
|
887
887
|
}
|
|
888
888
|
return promiseAll(result)
|
|
@@ -893,17 +893,17 @@ const arrayMapPool = function (array, concurrency, f) {
|
|
|
893
893
|
result = Array(arrayLength)
|
|
894
894
|
let index = -1
|
|
895
895
|
while (++index < arrayLength) {
|
|
896
|
-
const
|
|
897
|
-
if (isPromise(
|
|
896
|
+
const resultElement = f(array[index])
|
|
897
|
+
if (isPromise(resultElement)) {
|
|
898
898
|
const promises = new Set(),
|
|
899
|
-
selfDeletingPromise =
|
|
899
|
+
selfDeletingPromise = resultElement.then(
|
|
900
900
|
tapSync(() => promises.delete(selfDeletingPromise)))
|
|
901
901
|
promises.add(selfDeletingPromise)
|
|
902
902
|
result[index] = selfDeletingPromise
|
|
903
903
|
return arrayMapPoolAsync(
|
|
904
904
|
array, f, concurrency, result, index, promises)
|
|
905
905
|
}
|
|
906
|
-
result[index] =
|
|
906
|
+
result[index] = resultElement
|
|
907
907
|
}
|
|
908
908
|
return result
|
|
909
909
|
}
|
|
@@ -923,15 +923,15 @@ const _setMapPoolAsync = async function (
|
|
|
923
923
|
if (promises.size >= concurrency) {
|
|
924
924
|
await promiseRace(promises)
|
|
925
925
|
}
|
|
926
|
-
const
|
|
927
|
-
if (isPromise(
|
|
928
|
-
const selfDeletingPromise =
|
|
926
|
+
const resultElement = f(iteration.value, iteration.value, s)
|
|
927
|
+
if (isPromise(resultElement)) {
|
|
928
|
+
const selfDeletingPromise = resultElement.then(resolvedValue => {
|
|
929
929
|
promises.delete(selfDeletingPromise)
|
|
930
930
|
result.add(resolvedValue)
|
|
931
931
|
})
|
|
932
932
|
promises.add(selfDeletingPromise)
|
|
933
933
|
} else {
|
|
934
|
-
result.add(
|
|
934
|
+
result.add(resultElement)
|
|
935
935
|
}
|
|
936
936
|
iteration = iterator.next()
|
|
937
937
|
}
|
|
@@ -946,17 +946,17 @@ const setMapPool = function (s, concurrency, f) {
|
|
|
946
946
|
const iterator = s[symbolIterator]()
|
|
947
947
|
let iteration = iterator.next()
|
|
948
948
|
while (!iteration.done) {
|
|
949
|
-
const
|
|
950
|
-
if (isPromise(
|
|
949
|
+
const resultElement = f(iteration.value, iteration.value, s)
|
|
950
|
+
if (isPromise(resultElement)) {
|
|
951
951
|
const promises = new Set()
|
|
952
|
-
const selfDeletingPromise =
|
|
952
|
+
const selfDeletingPromise = resultElement.then(resolvedValue => {
|
|
953
953
|
promises.delete(selfDeletingPromise)
|
|
954
954
|
result.add(resolvedValue)
|
|
955
955
|
})
|
|
956
956
|
promises.add(selfDeletingPromise)
|
|
957
957
|
return _setMapPoolAsync(s, iterator, concurrency, f, result, promises)
|
|
958
958
|
}
|
|
959
|
-
result.add(
|
|
959
|
+
result.add(resultElement)
|
|
960
960
|
iteration = iterator.next()
|
|
961
961
|
}
|
|
962
962
|
return result
|
|
@@ -971,16 +971,16 @@ const _mapMapPoolAsync = async function (
|
|
|
971
971
|
await promiseRace(promises)
|
|
972
972
|
}
|
|
973
973
|
const key = iteration.value[0]
|
|
974
|
-
const
|
|
975
|
-
if (isPromise(
|
|
976
|
-
result.set(key,
|
|
977
|
-
const selfDeletingPromise =
|
|
974
|
+
const resultElement = f(iteration.value[1], key, m)
|
|
975
|
+
if (isPromise(resultElement)) {
|
|
976
|
+
result.set(key, resultElement)
|
|
977
|
+
const selfDeletingPromise = resultElement.then(resolvedValue => {
|
|
978
978
|
promises.delete(selfDeletingPromise)
|
|
979
979
|
result.set(key, resolvedValue)
|
|
980
980
|
})
|
|
981
981
|
promises.add(selfDeletingPromise)
|
|
982
982
|
} else {
|
|
983
|
-
result.set(key,
|
|
983
|
+
result.set(key, resultElement)
|
|
984
984
|
}
|
|
985
985
|
iteration = iterator.next()
|
|
986
986
|
}
|
|
@@ -996,18 +996,18 @@ const mapMapPool = function (m, concurrency, f) {
|
|
|
996
996
|
let iteration = iterator.next()
|
|
997
997
|
while (!iteration.done) {
|
|
998
998
|
const key = iteration.value[0]
|
|
999
|
-
const
|
|
1000
|
-
if (isPromise(
|
|
999
|
+
const resultElement = f(iteration.value[1], key, m)
|
|
1000
|
+
if (isPromise(resultElement)) {
|
|
1001
1001
|
const promises = new Set()
|
|
1002
|
-
result.set(key,
|
|
1003
|
-
const selfDeletingPromise =
|
|
1002
|
+
result.set(key, resultElement)
|
|
1003
|
+
const selfDeletingPromise = resultElement.then(resolvedValue => {
|
|
1004
1004
|
promises.delete(selfDeletingPromise)
|
|
1005
1005
|
result.set(key, resolvedValue)
|
|
1006
1006
|
})
|
|
1007
1007
|
promises.add(selfDeletingPromise)
|
|
1008
1008
|
return _mapMapPoolAsync(m, iterator, concurrency, f, result, promises)
|
|
1009
1009
|
}
|
|
1010
|
-
result.set(key,
|
|
1010
|
+
result.set(key, resultElement)
|
|
1011
1011
|
iteration = iterator.next()
|
|
1012
1012
|
}
|
|
1013
1013
|
return result
|
|
@@ -1023,16 +1023,16 @@ const _objectMapPoolAsync = async function (
|
|
|
1023
1023
|
if (promises.size >= concurrency) {
|
|
1024
1024
|
await promiseRace(promises)
|
|
1025
1025
|
}
|
|
1026
|
-
const
|
|
1027
|
-
if (isPromise(
|
|
1028
|
-
result[key] =
|
|
1029
|
-
const selfDeletingPromise =
|
|
1026
|
+
const resultElement = f(o[key], key, o)
|
|
1027
|
+
if (isPromise(resultElement)) {
|
|
1028
|
+
result[key] = resultElement
|
|
1029
|
+
const selfDeletingPromise = resultElement.then(resolvedValue => {
|
|
1030
1030
|
promises.delete(selfDeletingPromise)
|
|
1031
1031
|
result[key] = resolvedValue
|
|
1032
1032
|
})
|
|
1033
1033
|
promises.add(selfDeletingPromise)
|
|
1034
1034
|
} else {
|
|
1035
|
-
result[key] =
|
|
1035
|
+
result[key] = resultElement
|
|
1036
1036
|
}
|
|
1037
1037
|
}
|
|
1038
1038
|
if (promises.size > 0) {
|
|
@@ -1046,18 +1046,18 @@ const objectMapPool = function (o, concurrency, f) {
|
|
|
1046
1046
|
const doneKeys = {}
|
|
1047
1047
|
for (const key in o) {
|
|
1048
1048
|
doneKeys[key] = true
|
|
1049
|
-
const
|
|
1050
|
-
if (isPromise(
|
|
1049
|
+
const resultElement = f(o[key], key, o)
|
|
1050
|
+
if (isPromise(resultElement)) {
|
|
1051
1051
|
const promises = new Set()
|
|
1052
|
-
result[key] =
|
|
1053
|
-
const selfDeletingPromise =
|
|
1052
|
+
result[key] = resultElement
|
|
1053
|
+
const selfDeletingPromise = resultElement.then(resolvedValue => {
|
|
1054
1054
|
promises.delete(selfDeletingPromise)
|
|
1055
1055
|
result[key] = resolvedValue
|
|
1056
1056
|
})
|
|
1057
1057
|
promises.add(selfDeletingPromise)
|
|
1058
1058
|
return _objectMapPoolAsync(o, concurrency, f, result, doneKeys, promises)
|
|
1059
1059
|
}
|
|
1060
|
-
result[key] =
|
|
1060
|
+
result[key] = resultElement
|
|
1061
1061
|
}
|
|
1062
1062
|
return result
|
|
1063
1063
|
}
|
|
@@ -1359,15 +1359,15 @@ const arrayFilter = function (array, predicate) {
|
|
|
1359
1359
|
let index = -1,
|
|
1360
1360
|
resultIndex = -1
|
|
1361
1361
|
while (++index < arrayLength) {
|
|
1362
|
-
const
|
|
1363
|
-
|
|
1364
|
-
if (isPromise(
|
|
1362
|
+
const element = array[index],
|
|
1363
|
+
shouldIncludeElement = predicate(element, index, array)
|
|
1364
|
+
if (isPromise(shouldIncludeElement)) {
|
|
1365
1365
|
return promiseAll(
|
|
1366
|
-
arrayExtendMap([
|
|
1366
|
+
arrayExtendMap([shouldIncludeElement], array, predicate, index)
|
|
1367
1367
|
).then(curry4(arrayFilterByConditions, array, result, index - 1, __))
|
|
1368
1368
|
}
|
|
1369
|
-
if (
|
|
1370
|
-
result[++resultIndex] =
|
|
1369
|
+
if (shouldIncludeElement) {
|
|
1370
|
+
result[++resultIndex] = element
|
|
1371
1371
|
}
|
|
1372
1372
|
}
|
|
1373
1373
|
return result
|
|
@@ -1390,13 +1390,13 @@ const setFilter = function (value, predicate) {
|
|
|
1390
1390
|
const result = new Set(),
|
|
1391
1391
|
resultAdd = result.add.bind(result),
|
|
1392
1392
|
promises = []
|
|
1393
|
-
for (const
|
|
1394
|
-
const predication = predicate(
|
|
1393
|
+
for (const element of value) {
|
|
1394
|
+
const predication = predicate(element, element, value)
|
|
1395
1395
|
if (isPromise(predication)) {
|
|
1396
1396
|
promises.push(predication.then(curry3(
|
|
1397
|
-
thunkConditional, __, thunkify1(resultAdd,
|
|
1397
|
+
thunkConditional, __, thunkify1(resultAdd, element), noop)))
|
|
1398
1398
|
} else if (predication) {
|
|
1399
|
-
result.add(
|
|
1399
|
+
result.add(element)
|
|
1400
1400
|
}
|
|
1401
1401
|
}
|
|
1402
1402
|
return promises.length == 0
|
|
@@ -1407,15 +1407,15 @@ const setFilter = function (value, predicate) {
|
|
|
1407
1407
|
const mapFilter = function (map, predicate) {
|
|
1408
1408
|
const result = new Map(),
|
|
1409
1409
|
promises = []
|
|
1410
|
-
for (const [key,
|
|
1411
|
-
const predication = predicate(
|
|
1410
|
+
for (const [key, element] of map) {
|
|
1411
|
+
const predication = predicate(element, key, map)
|
|
1412
1412
|
if (isPromise(predication)) {
|
|
1413
1413
|
promises.push(predication.then(curry3(thunkConditional,
|
|
1414
1414
|
__,
|
|
1415
|
-
thunkify4(callPropBinary, result, 'set', key,
|
|
1415
|
+
thunkify4(callPropBinary, result, 'set', key, element),
|
|
1416
1416
|
noop)))
|
|
1417
1417
|
} else if (predication) {
|
|
1418
|
-
result.set(key,
|
|
1418
|
+
result.set(key, element)
|
|
1419
1419
|
}
|
|
1420
1420
|
}
|
|
1421
1421
|
return promises.length == 0 ? result
|
|
@@ -1434,13 +1434,13 @@ const objectFilter = function (object, predicate) {
|
|
|
1434
1434
|
const result = {},
|
|
1435
1435
|
promises = []
|
|
1436
1436
|
for (const key in object) {
|
|
1437
|
-
const
|
|
1438
|
-
|
|
1439
|
-
if (isPromise(
|
|
1440
|
-
promises.push(
|
|
1437
|
+
const element = object[key],
|
|
1438
|
+
shouldIncludeElement = predicate(element, key, object)
|
|
1439
|
+
if (isPromise(shouldIncludeElement)) {
|
|
1440
|
+
promises.push(shouldIncludeElement.then(
|
|
1441
1441
|
curry4(objectSetIf, result, key, object[key], __)))
|
|
1442
|
-
} else if (
|
|
1443
|
-
result[key] =
|
|
1442
|
+
} else if (shouldIncludeElement) {
|
|
1443
|
+
result[key] = element
|
|
1444
1444
|
}
|
|
1445
1445
|
}
|
|
1446
1446
|
return promises.length == 0
|
|
@@ -1702,11 +1702,11 @@ const mapReduce = function (map, reducer, result) {
|
|
|
1702
1702
|
|
|
1703
1703
|
const reducerConcat = (
|
|
1704
1704
|
reducerA, reducerB,
|
|
1705
|
-
) => function pipedReducer(result,
|
|
1706
|
-
const intermediate = reducerA(result,
|
|
1705
|
+
) => function pipedReducer(result, element) {
|
|
1706
|
+
const intermediate = reducerA(result, element)
|
|
1707
1707
|
return isPromise(intermediate)
|
|
1708
|
-
? intermediate.then(curry2(reducerB, __,
|
|
1709
|
-
: reducerB(intermediate,
|
|
1708
|
+
? intermediate.then(curry2(reducerB, __, element))
|
|
1709
|
+
: reducerB(intermediate, element)
|
|
1710
1710
|
}
|
|
1711
1711
|
|
|
1712
1712
|
const genericReduce = function (collection, reducer, result) {
|
|
@@ -1946,7 +1946,7 @@ const FlatMappingIterator = function (iterator, flatMapper) {
|
|
|
1946
1946
|
const monadAsArray = genericReduce(
|
|
1947
1947
|
flatMapper(iteration.value),
|
|
1948
1948
|
arrayPush,
|
|
1949
|
-
[]) // this will always have at least one
|
|
1949
|
+
[]) // this will always have at least one element
|
|
1950
1950
|
if (monadAsArray.length > 1) {
|
|
1951
1951
|
buffer = monadAsArray
|
|
1952
1952
|
bufferIndex = 1
|
|
@@ -2025,8 +2025,8 @@ const funcConcatSync = (
|
|
|
2025
2025
|
|
|
2026
2026
|
const asyncIteratorForEach = async function (asyncIterator, callback) {
|
|
2027
2027
|
const promises = []
|
|
2028
|
-
for await (const
|
|
2029
|
-
const operation = callback(
|
|
2028
|
+
for await (const element of asyncIterator) {
|
|
2029
|
+
const operation = callback(element)
|
|
2030
2030
|
if (isPromise(operation)) {
|
|
2031
2031
|
promises.push(operation)
|
|
2032
2032
|
}
|
|
@@ -2042,44 +2042,44 @@ const arrayFlatten = function (array) {
|
|
|
2042
2042
|
let index = -1
|
|
2043
2043
|
|
|
2044
2044
|
while (++index < length) {
|
|
2045
|
-
const
|
|
2046
|
-
if (isArray(
|
|
2047
|
-
const
|
|
2048
|
-
let
|
|
2049
|
-
while (++
|
|
2050
|
-
result.push(
|
|
2045
|
+
const element = array[index]
|
|
2046
|
+
if (isArray(element)) {
|
|
2047
|
+
const elementLength = element.length
|
|
2048
|
+
let elementIndex = -1
|
|
2049
|
+
while (++elementIndex < elementLength) {
|
|
2050
|
+
result.push(element[elementIndex])
|
|
2051
2051
|
}
|
|
2052
|
-
} else if (
|
|
2053
|
-
result.push(
|
|
2054
|
-
} else if (typeof
|
|
2055
|
-
promises.push(
|
|
2056
|
-
} else if (typeof
|
|
2057
|
-
for (const
|
|
2058
|
-
result.push(
|
|
2052
|
+
} else if (element == null) {
|
|
2053
|
+
result.push(element)
|
|
2054
|
+
} else if (typeof element.then == 'function') {
|
|
2055
|
+
promises.push(element.then(curry2(arrayPush, result, __)))
|
|
2056
|
+
} else if (typeof element[symbolIterator] == 'function') {
|
|
2057
|
+
for (const subElement of element) {
|
|
2058
|
+
result.push(subElement)
|
|
2059
2059
|
}
|
|
2060
|
-
} else if (typeof
|
|
2060
|
+
} else if (typeof element[symbolAsyncIterator] == 'function') {
|
|
2061
2061
|
promises.push(asyncIteratorForEach(
|
|
2062
|
-
|
|
2063
|
-
} else if (typeof
|
|
2064
|
-
const monadValue =
|
|
2062
|
+
element[symbolAsyncIterator](), curry2(arrayPush, result, __)))
|
|
2063
|
+
} else if (typeof element.chain == 'function') {
|
|
2064
|
+
const monadValue = element.chain(identity)
|
|
2065
2065
|
isPromise(monadValue)
|
|
2066
2066
|
? promises.push(monadValue.then(curry2(arrayPush, result, __)))
|
|
2067
2067
|
: result.push(monadValue)
|
|
2068
|
-
} else if (typeof
|
|
2069
|
-
const monadValue =
|
|
2068
|
+
} else if (typeof element.flatMap == 'function') {
|
|
2069
|
+
const monadValue = element.flatMap(identity)
|
|
2070
2070
|
isPromise(monadValue)
|
|
2071
2071
|
? promises.push(monadValue.then(curry2(arrayPush, result, __)))
|
|
2072
2072
|
: result.push(monadValue)
|
|
2073
|
-
} else if (typeof
|
|
2074
|
-
const folded =
|
|
2073
|
+
} else if (typeof element.reduce == 'function') {
|
|
2074
|
+
const folded = element.reduce(funcConcatSync(
|
|
2075
2075
|
getArg1, curry2(arrayPush, result, __)), null)
|
|
2076
2076
|
isPromise(folded) && promises.push(folded)
|
|
2077
|
-
} else if (
|
|
2078
|
-
for (const key in
|
|
2079
|
-
result.push(
|
|
2077
|
+
} else if (element.constructor == Object) {
|
|
2078
|
+
for (const key in element) {
|
|
2079
|
+
result.push(element[key])
|
|
2080
2080
|
}
|
|
2081
2081
|
} else {
|
|
2082
|
-
result.push(
|
|
2082
|
+
result.push(element)
|
|
2083
2083
|
}
|
|
2084
2084
|
}
|
|
2085
2085
|
return promises.length == 0
|
|
@@ -2102,31 +2102,31 @@ const objectFlatten = function (object) {
|
|
|
2102
2102
|
getResult = () => result
|
|
2103
2103
|
|
|
2104
2104
|
for (const key in object) {
|
|
2105
|
-
const
|
|
2106
|
-
if (
|
|
2105
|
+
const element = object[key]
|
|
2106
|
+
if (element == null) {
|
|
2107
2107
|
continue
|
|
2108
|
-
} else if (typeof
|
|
2109
|
-
for (const
|
|
2110
|
-
objectAssign(result,
|
|
2108
|
+
} else if (typeof element[symbolIterator] == 'function') {
|
|
2109
|
+
for (const monadElement of element) {
|
|
2110
|
+
objectAssign(result, monadElement)
|
|
2111
2111
|
}
|
|
2112
|
-
} else if (typeof
|
|
2112
|
+
} else if (typeof element[symbolAsyncIterator] == 'function') {
|
|
2113
2113
|
promises.push(
|
|
2114
|
-
asyncIteratorForEach(
|
|
2115
|
-
} else if (typeof
|
|
2116
|
-
const monadValue =
|
|
2114
|
+
asyncIteratorForEach(element[symbolAsyncIterator](), resultAssign))
|
|
2115
|
+
} else if (typeof element.chain == 'function') {
|
|
2116
|
+
const monadValue = element.chain(identity)
|
|
2117
2117
|
isPromise(monadValue)
|
|
2118
2118
|
? promises.push(monadValue.then(resultAssign))
|
|
2119
2119
|
: objectAssign(result, monadValue)
|
|
2120
|
-
} else if (typeof
|
|
2121
|
-
const monadValue =
|
|
2120
|
+
} else if (typeof element.flatMap == 'function') {
|
|
2121
|
+
const monadValue = element.flatMap(identity)
|
|
2122
2122
|
isPromise(monadValue)
|
|
2123
2123
|
? promises.push(monadValue.then(resultAssign))
|
|
2124
2124
|
: resultAssign(monadValue)
|
|
2125
|
-
} else if (typeof
|
|
2126
|
-
const folded =
|
|
2125
|
+
} else if (typeof element.reduce == 'function') {
|
|
2126
|
+
const folded = element.reduce(resultAssignReducer, null)
|
|
2127
2127
|
isPromise(folded) && promises.push(folded)
|
|
2128
2128
|
} else {
|
|
2129
|
-
objectAssign(result,
|
|
2129
|
+
objectAssign(result, element)
|
|
2130
2130
|
}
|
|
2131
2131
|
}
|
|
2132
2132
|
return promises.length == 0
|
|
@@ -2145,45 +2145,45 @@ const setFlatten = function (set) {
|
|
|
2145
2145
|
const size = set.size,
|
|
2146
2146
|
promises = [],
|
|
2147
2147
|
result = new Set(),
|
|
2148
|
-
resultAddReducer = (_,
|
|
2148
|
+
resultAddReducer = (_, subElement) => result.add(subElement),
|
|
2149
2149
|
resultAdd = curry3(callPropUnary, result, 'add', __),
|
|
2150
2150
|
getResult = () => result
|
|
2151
2151
|
|
|
2152
|
-
for (const
|
|
2153
|
-
if (isArray(
|
|
2154
|
-
const
|
|
2155
|
-
let
|
|
2156
|
-
while (++
|
|
2157
|
-
result.add(
|
|
2152
|
+
for (const element of set) {
|
|
2153
|
+
if (isArray(element)) {
|
|
2154
|
+
const elementLength = element.length
|
|
2155
|
+
let elementIndex = -1
|
|
2156
|
+
while (++elementIndex < elementLength) {
|
|
2157
|
+
result.add(element[elementIndex])
|
|
2158
2158
|
}
|
|
2159
|
-
} else if (
|
|
2160
|
-
result.add(
|
|
2161
|
-
} else if (typeof
|
|
2162
|
-
for (const
|
|
2163
|
-
result.add(
|
|
2159
|
+
} else if (element == null) {
|
|
2160
|
+
result.add(element)
|
|
2161
|
+
} else if (typeof element[symbolIterator] == 'function') {
|
|
2162
|
+
for (const subElement of element) {
|
|
2163
|
+
result.add(subElement)
|
|
2164
2164
|
}
|
|
2165
|
-
} else if (typeof
|
|
2165
|
+
} else if (typeof element[symbolAsyncIterator] == 'function') {
|
|
2166
2166
|
promises.push(
|
|
2167
|
-
asyncIteratorForEach(
|
|
2168
|
-
} else if (typeof
|
|
2169
|
-
const monadValue =
|
|
2167
|
+
asyncIteratorForEach(element[symbolAsyncIterator](), resultAdd))
|
|
2168
|
+
} else if (typeof element.chain == 'function') {
|
|
2169
|
+
const monadValue = element.chain(identity)
|
|
2170
2170
|
isPromise(monadValue)
|
|
2171
2171
|
? promises.push(monadValue.then(resultAdd))
|
|
2172
2172
|
: result.add(monadValue)
|
|
2173
|
-
} else if (typeof
|
|
2174
|
-
const monadValue =
|
|
2173
|
+
} else if (typeof element.flatMap == 'function') {
|
|
2174
|
+
const monadValue = element.flatMap(identity)
|
|
2175
2175
|
isPromise(monadValue)
|
|
2176
2176
|
? promises.push(monadValue.then(resultAdd))
|
|
2177
2177
|
: result.add(monadValue)
|
|
2178
|
-
} else if (typeof
|
|
2179
|
-
const folded =
|
|
2178
|
+
} else if (typeof element.reduce == 'function') {
|
|
2179
|
+
const folded = element.reduce(resultAddReducer, null)
|
|
2180
2180
|
isPromise(folded) && promises.push(folded)
|
|
2181
|
-
} else if (
|
|
2182
|
-
for (const key in
|
|
2183
|
-
result.add(
|
|
2181
|
+
} else if (element.constructor == Object) {
|
|
2182
|
+
for (const key in element) {
|
|
2183
|
+
result.add(element[key])
|
|
2184
2184
|
}
|
|
2185
2185
|
} else {
|
|
2186
|
-
result.add(
|
|
2186
|
+
result.add(element)
|
|
2187
2187
|
}
|
|
2188
2188
|
}
|
|
2189
2189
|
return promises.length == 0 ? result : promiseAll(promises).then(getResult)
|
|
@@ -2279,8 +2279,8 @@ const objectForEach = function (object, callback) {
|
|
|
2279
2279
|
|
|
2280
2280
|
const iteratorForEach = function (iterator, callback) {
|
|
2281
2281
|
const promises = []
|
|
2282
|
-
for (const
|
|
2283
|
-
const operation = callback(
|
|
2282
|
+
for (const element of iterator) {
|
|
2283
|
+
const operation = callback(element)
|
|
2284
2284
|
if (isPromise(operation)) {
|
|
2285
2285
|
promises.push(operation)
|
|
2286
2286
|
}
|
|
@@ -2378,8 +2378,8 @@ const iteratorForEachSeries = function (iterator, callback) {
|
|
|
2378
2378
|
}
|
|
2379
2379
|
|
|
2380
2380
|
const asyncIteratorForEachSeries = async function (asyncIterator, callback) {
|
|
2381
|
-
for await (const
|
|
2382
|
-
const operation = callback(
|
|
2381
|
+
for await (const element of asyncIterator) {
|
|
2382
|
+
const operation = callback(element)
|
|
2383
2383
|
if (isPromise(operation)) {
|
|
2384
2384
|
await operation
|
|
2385
2385
|
}
|
|
@@ -2531,8 +2531,8 @@ const asyncIteratorSome = async function (
|
|
|
2531
2531
|
}
|
|
2532
2532
|
|
|
2533
2533
|
const iteratorSome = function (iterator, predicate) {
|
|
2534
|
-
for (const
|
|
2535
|
-
const predication = predicate(
|
|
2534
|
+
for (const element of iterator) {
|
|
2535
|
+
const predication = predicate(element)
|
|
2536
2536
|
if (isPromise(predication)) {
|
|
2537
2537
|
return asyncIteratorSome(
|
|
2538
2538
|
iterator, predicate, new Set([SelfReferencingPromise(predication)]))
|
|
@@ -2544,14 +2544,14 @@ const iteratorSome = function (iterator, predicate) {
|
|
|
2544
2544
|
return false
|
|
2545
2545
|
}
|
|
2546
2546
|
|
|
2547
|
-
const reducerAnySync = predicate => function anyReducer(result,
|
|
2548
|
-
return result ? true : predicate(
|
|
2547
|
+
const reducerAnySync = predicate => function anyReducer(result, element) {
|
|
2548
|
+
return result ? true : predicate(element)
|
|
2549
2549
|
}
|
|
2550
2550
|
|
|
2551
|
-
const reducerSome = predicate => function anyReducer(result,
|
|
2551
|
+
const reducerSome = predicate => function anyReducer(result, element) {
|
|
2552
2552
|
return result === true ? result
|
|
2553
|
-
: isPromise(result) ? result.then(curry2(reducerAnySync(predicate), __,
|
|
2554
|
-
: result ? true : predicate(
|
|
2553
|
+
: isPromise(result) ? result.then(curry2(reducerAnySync(predicate), __, element))
|
|
2554
|
+
: result ? true : predicate(element)
|
|
2555
2555
|
}
|
|
2556
2556
|
|
|
2557
2557
|
// _some(collection Array|Iterable|AsyncIterable|{ reduce: function }|Object, predicate function) -> Promise|boolean
|
|
@@ -2607,8 +2607,8 @@ const arrayEvery = function (array, predicate) {
|
|
|
2607
2607
|
|
|
2608
2608
|
const iteratorEvery = function (iterator, predicate) {
|
|
2609
2609
|
const promises = []
|
|
2610
|
-
for (const
|
|
2611
|
-
const predication = predicate(
|
|
2610
|
+
for (const element of iterator) {
|
|
2611
|
+
const predication = predicate(element)
|
|
2612
2612
|
if (isPromise(predication)) {
|
|
2613
2613
|
promises.push(predication)
|
|
2614
2614
|
} else if (!predication) {
|
|
@@ -2651,13 +2651,13 @@ const asyncIteratorEvery = async function (
|
|
|
2651
2651
|
return true
|
|
2652
2652
|
}
|
|
2653
2653
|
|
|
2654
|
-
const reducerAllSync = (predicate, result,
|
|
2654
|
+
const reducerAllSync = (predicate, result, element) => result ? predicate(element) : false
|
|
2655
2655
|
|
|
2656
|
-
const reducerEvery = predicate => function allReducer(result,
|
|
2656
|
+
const reducerEvery = predicate => function allReducer(result, element) {
|
|
2657
2657
|
return result === false ? false
|
|
2658
2658
|
: isPromise(result) ? result.then(
|
|
2659
|
-
curry3(reducerAllSync, predicate, __,
|
|
2660
|
-
: result ? predicate(
|
|
2659
|
+
curry3(reducerAllSync, predicate, __, element))
|
|
2660
|
+
: result ? predicate(element) : false
|
|
2661
2661
|
}
|
|
2662
2662
|
|
|
2663
2663
|
// _every(collection Array|Iterable|AsyncIterable|{ reduce: function }|Object, predicate function) -> Promise|boolean
|
|
@@ -3214,13 +3214,13 @@ const deleteByPath = function (object, path) {
|
|
|
3214
3214
|
const objectCopyDeep = function (object) {
|
|
3215
3215
|
const result = {}
|
|
3216
3216
|
for (const key in object) {
|
|
3217
|
-
const
|
|
3218
|
-
if (isArray(
|
|
3219
|
-
result[key] = arrayCopyDeep(
|
|
3220
|
-
} else if (
|
|
3221
|
-
result[key] = objectCopyDeep(
|
|
3217
|
+
const element = object[key]
|
|
3218
|
+
if (isArray(element)) {
|
|
3219
|
+
result[key] = arrayCopyDeep(element)
|
|
3220
|
+
} else if (element != null && element.constructor == Object) {
|
|
3221
|
+
result[key] = objectCopyDeep(element)
|
|
3222
3222
|
} else {
|
|
3223
|
-
result[key] =
|
|
3223
|
+
result[key] = element
|
|
3224
3224
|
}
|
|
3225
3225
|
}
|
|
3226
3226
|
return result
|
|
@@ -3232,13 +3232,13 @@ const arrayCopyDeep = function (array) {
|
|
|
3232
3232
|
result = []
|
|
3233
3233
|
let index = -1
|
|
3234
3234
|
while (++index < length) {
|
|
3235
|
-
const
|
|
3236
|
-
if (isArray(
|
|
3237
|
-
result[index] = arrayCopyDeep(
|
|
3238
|
-
} else if (
|
|
3239
|
-
result[index] = objectCopyDeep(
|
|
3235
|
+
const element = array[index]
|
|
3236
|
+
if (isArray(element)) {
|
|
3237
|
+
result[index] = arrayCopyDeep(element)
|
|
3238
|
+
} else if (element != null && element.constructor == Object) {
|
|
3239
|
+
result[index] = objectCopyDeep(element)
|
|
3240
3240
|
} else {
|
|
3241
|
-
result[index] =
|
|
3241
|
+
result[index] = element
|
|
3242
3242
|
}
|
|
3243
3243
|
}
|
|
3244
3244
|
return result
|