rubico 2.7.3 → 2.7.5
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/LICENSE +1 -1
- package/README.md +27 -30
- 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/global.js +1 -0
- 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/global.d.ts +0 -1
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.7.
|
|
2
|
+
* rubico v2.7.5
|
|
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.
|
|
@@ -305,11 +305,11 @@ const functionArrayAll = function (funcs, args) {
|
|
|
305
305
|
let funcsIndex = -1, isAsync = false
|
|
306
306
|
while (++funcsIndex < funcsLength) {
|
|
307
307
|
const f = funcs[funcsIndex]
|
|
308
|
-
const
|
|
309
|
-
if (isPromise(
|
|
308
|
+
const resultElement = typeof f == 'function' ? f(...args) : f
|
|
309
|
+
if (isPromise(resultElement)) {
|
|
310
310
|
isAsync = true
|
|
311
311
|
}
|
|
312
|
-
result[funcsIndex] =
|
|
312
|
+
result[funcsIndex] = resultElement
|
|
313
313
|
}
|
|
314
314
|
return isAsync ? promiseAll(result) : result
|
|
315
315
|
}
|
|
@@ -363,8 +363,8 @@ const objectSet = function (object, property, value) {
|
|
|
363
363
|
const asyncFunctionArrayAllSeries = async function (funcs, args, result, funcsIndex) {
|
|
364
364
|
const funcsLength = funcs.length
|
|
365
365
|
while (++funcsIndex < funcsLength) {
|
|
366
|
-
const
|
|
367
|
-
result[funcsIndex] = isPromise(
|
|
366
|
+
const resultElement = funcs[funcsIndex](...args)
|
|
367
|
+
result[funcsIndex] = isPromise(resultElement) ? await resultElement : resultElement
|
|
368
368
|
}
|
|
369
369
|
return result
|
|
370
370
|
}
|
|
@@ -373,13 +373,13 @@ const functionArrayAllSeries = function (funcs, args) {
|
|
|
373
373
|
const funcsLength = funcs.length, result = []
|
|
374
374
|
let funcsIndex = -1
|
|
375
375
|
while (++funcsIndex < funcsLength) {
|
|
376
|
-
const
|
|
377
|
-
if (isPromise(
|
|
378
|
-
return
|
|
376
|
+
const resultElement = funcs[funcsIndex](...args)
|
|
377
|
+
if (isPromise(resultElement)) {
|
|
378
|
+
return resultElement.then(funcConcat(
|
|
379
379
|
curry3(objectSet, result, funcsIndex, __),
|
|
380
380
|
curry4(asyncFunctionArrayAllSeries, funcs, args, __, funcsIndex)))
|
|
381
381
|
}
|
|
382
|
-
result[funcsIndex] =
|
|
382
|
+
result[funcsIndex] = resultElement
|
|
383
383
|
}
|
|
384
384
|
return result
|
|
385
385
|
}
|
|
@@ -388,11 +388,11 @@ const functionObjectAll = function (funcs, args) {
|
|
|
388
388
|
const result = {}, promises = []
|
|
389
389
|
for (const key in funcs) {
|
|
390
390
|
const f = funcs[key]
|
|
391
|
-
const
|
|
392
|
-
if (isPromise(
|
|
393
|
-
promises.push(
|
|
391
|
+
const resultElement = typeof f == 'function' ? f(...args) : f
|
|
392
|
+
if (isPromise(resultElement)) {
|
|
393
|
+
promises.push(resultElement.then(curry3(objectSet, result, key, __)))
|
|
394
394
|
} else {
|
|
395
|
-
result[key] =
|
|
395
|
+
result[key] = resultElement
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
398
|
return promises.length == 0 ? result : promiseAll(promises).then(always(result))
|
|
@@ -642,11 +642,11 @@ const arrayMap = function (array, mapper) {
|
|
|
642
642
|
isAsync = false
|
|
643
643
|
|
|
644
644
|
while (++index < arrayLength) {
|
|
645
|
-
const
|
|
646
|
-
if (isPromise(
|
|
645
|
+
const resultElement = mapper(array[index], index, array)
|
|
646
|
+
if (isPromise(resultElement)) {
|
|
647
647
|
isAsync = true
|
|
648
648
|
}
|
|
649
|
-
result[index] =
|
|
649
|
+
result[index] = resultElement
|
|
650
650
|
}
|
|
651
651
|
return isAsync ? promiseAll(result) : result
|
|
652
652
|
}
|
|
@@ -663,12 +663,12 @@ const stringMap = function (string, mapper) {
|
|
|
663
663
|
const setMap = function (set, mapper) {
|
|
664
664
|
const result = new Set(),
|
|
665
665
|
promises = []
|
|
666
|
-
for (const
|
|
667
|
-
const
|
|
668
|
-
if (isPromise(
|
|
669
|
-
promises.push(
|
|
666
|
+
for (const element of set) {
|
|
667
|
+
const resultElement = mapper(element, element, set)
|
|
668
|
+
if (isPromise(resultElement)) {
|
|
669
|
+
promises.push(resultElement.then(curry3(callPropUnary, result, 'add', __)))
|
|
670
670
|
} else {
|
|
671
|
-
result.add(
|
|
671
|
+
result.add(resultElement)
|
|
672
672
|
}
|
|
673
673
|
}
|
|
674
674
|
return promises.length == 0
|
|
@@ -681,13 +681,13 @@ const callPropBinary = (value, property, arg0, arg1) => value[property](arg0, ar
|
|
|
681
681
|
const mapMap = function (value, mapper) {
|
|
682
682
|
const result = new Map(),
|
|
683
683
|
promises = []
|
|
684
|
-
for (const [key,
|
|
685
|
-
const
|
|
686
|
-
if (isPromise(
|
|
687
|
-
promises.push(
|
|
684
|
+
for (const [key, element] of value) {
|
|
685
|
+
const resultElement = mapper(element, key, value)
|
|
686
|
+
if (isPromise(resultElement)) {
|
|
687
|
+
promises.push(resultElement.then(
|
|
688
688
|
curry4(callPropBinary, result, 'set', key, __)))
|
|
689
689
|
} else {
|
|
690
|
-
result.set(key,
|
|
690
|
+
result.set(key, resultElement)
|
|
691
691
|
}
|
|
692
692
|
}
|
|
693
693
|
return promises.length == 0
|
|
@@ -699,11 +699,11 @@ const objectMap = function (object, mapper) {
|
|
|
699
699
|
const result = {}
|
|
700
700
|
let isAsync = false
|
|
701
701
|
for (const key in object) {
|
|
702
|
-
const
|
|
703
|
-
if (isPromise(
|
|
702
|
+
const resultElement = mapper(object[key], key, object)
|
|
703
|
+
if (isPromise(resultElement)) {
|
|
704
704
|
isAsync = true
|
|
705
705
|
}
|
|
706
|
-
result[key] =
|
|
706
|
+
result[key] = resultElement
|
|
707
707
|
}
|
|
708
708
|
return isAsync ? promiseObjectAll(result) : result
|
|
709
709
|
}
|
|
@@ -713,8 +713,8 @@ const arrayMapSeriesAsync = async function (
|
|
|
713
713
|
) {
|
|
714
714
|
const arrayLength = array.length
|
|
715
715
|
while (++index < arrayLength) {
|
|
716
|
-
const
|
|
717
|
-
result[index] = isPromise(
|
|
716
|
+
const resultElement = mapper(array[index], index)
|
|
717
|
+
result[index] = isPromise(resultElement) ? await resultElement : resultElement
|
|
718
718
|
}
|
|
719
719
|
return result
|
|
720
720
|
}
|
|
@@ -725,13 +725,13 @@ const arrayMapSeries = function (array, mapper) {
|
|
|
725
725
|
let index = -1
|
|
726
726
|
|
|
727
727
|
while (++index < arrayLength) {
|
|
728
|
-
const
|
|
729
|
-
if (isPromise(
|
|
730
|
-
return
|
|
728
|
+
const resultElement = mapper(array[index], index)
|
|
729
|
+
if (isPromise(resultElement)) {
|
|
730
|
+
return resultElement.then(funcConcat(
|
|
731
731
|
curry3(objectSet, result, index, __),
|
|
732
732
|
curry4(arrayMapSeriesAsync, array, mapper, __, index)))
|
|
733
733
|
}
|
|
734
|
-
result[index] =
|
|
734
|
+
result[index] = resultElement
|
|
735
735
|
}
|
|
736
736
|
return result
|
|
737
737
|
}
|
|
@@ -758,11 +758,11 @@ const _objectMapSeriesAsync = async function (object, f, result, doneKeys) {
|
|
|
758
758
|
if (key in doneKeys) {
|
|
759
759
|
continue
|
|
760
760
|
}
|
|
761
|
-
let
|
|
762
|
-
if (isPromise(
|
|
763
|
-
|
|
761
|
+
let resultElement = f(object[key])
|
|
762
|
+
if (isPromise(resultElement)) {
|
|
763
|
+
resultElement = await resultElement
|
|
764
764
|
}
|
|
765
|
-
result[key] =
|
|
765
|
+
result[key] = resultElement
|
|
766
766
|
}
|
|
767
767
|
return result
|
|
768
768
|
}
|
|
@@ -772,14 +772,14 @@ const objectMapSeries = function (object, f) {
|
|
|
772
772
|
const doneKeys = {}
|
|
773
773
|
for (const key in object) {
|
|
774
774
|
doneKeys[key] = true
|
|
775
|
-
const
|
|
776
|
-
if (isPromise(
|
|
777
|
-
return
|
|
775
|
+
const resultElement = f(object[key], key, object)
|
|
776
|
+
if (isPromise(resultElement)) {
|
|
777
|
+
return resultElement.then(funcConcat(
|
|
778
778
|
curry3(objectSet, result, key, __),
|
|
779
779
|
thunkify4(_objectMapSeriesAsync, object, f, result, doneKeys),
|
|
780
780
|
))
|
|
781
781
|
}
|
|
782
|
-
result[key] =
|
|
782
|
+
result[key] = resultElement
|
|
783
783
|
}
|
|
784
784
|
return result
|
|
785
785
|
}
|
|
@@ -797,11 +797,11 @@ const setAdd = function (set, value) {
|
|
|
797
797
|
const _setMapSeriesAsync = async function (iterator, f, result) {
|
|
798
798
|
let iteration = iterator.next()
|
|
799
799
|
while (!iteration.done) {
|
|
800
|
-
let
|
|
801
|
-
if (isPromise(
|
|
802
|
-
|
|
800
|
+
let resultElement = f(iteration.value)
|
|
801
|
+
if (isPromise(resultElement)) {
|
|
802
|
+
resultElement = await resultElement
|
|
803
803
|
}
|
|
804
|
-
result.add(
|
|
804
|
+
result.add(resultElement)
|
|
805
805
|
iteration = iterator.next()
|
|
806
806
|
}
|
|
807
807
|
return result
|
|
@@ -812,14 +812,14 @@ const setMapSeries = function (set, f) {
|
|
|
812
812
|
const iterator = set[symbolIterator]()
|
|
813
813
|
let iteration = iterator.next()
|
|
814
814
|
while (!iteration.done) {
|
|
815
|
-
const
|
|
816
|
-
if (isPromise(
|
|
817
|
-
return
|
|
815
|
+
const resultElement = f(iteration.value)
|
|
816
|
+
if (isPromise(resultElement)) {
|
|
817
|
+
return resultElement.then(funcConcat(
|
|
818
818
|
curry2(setAdd, result, __),
|
|
819
819
|
thunkify3(_setMapSeriesAsync, iterator, f, result),
|
|
820
820
|
))
|
|
821
821
|
}
|
|
822
|
-
result.add(
|
|
822
|
+
result.add(resultElement)
|
|
823
823
|
iteration = iterator.next()
|
|
824
824
|
}
|
|
825
825
|
return result
|
|
@@ -837,11 +837,11 @@ const mapSet = function setting(source, key, value) {
|
|
|
837
837
|
const _mapMapSeriesAsync = async function (iterator, f, result) {
|
|
838
838
|
let iteration = iterator.next()
|
|
839
839
|
while (!iteration.done) {
|
|
840
|
-
let
|
|
841
|
-
if (isPromise(
|
|
842
|
-
|
|
840
|
+
let resultElement = f(iteration.value[1])
|
|
841
|
+
if (isPromise(resultElement)) {
|
|
842
|
+
resultElement = await resultElement
|
|
843
843
|
}
|
|
844
|
-
result.set(iteration.value[0],
|
|
844
|
+
result.set(iteration.value[0], resultElement)
|
|
845
845
|
iteration = iterator.next()
|
|
846
846
|
}
|
|
847
847
|
return result
|
|
@@ -853,14 +853,14 @@ const mapMapSeries = function (map, f) {
|
|
|
853
853
|
let iteration = iterator.next()
|
|
854
854
|
while (!iteration.done) {
|
|
855
855
|
const key = iteration.value[0]
|
|
856
|
-
const
|
|
857
|
-
if (isPromise(
|
|
858
|
-
return
|
|
856
|
+
const resultElement = f(iteration.value[1])
|
|
857
|
+
if (isPromise(resultElement)) {
|
|
858
|
+
return resultElement.then(funcConcat(
|
|
859
859
|
curry3(mapSet, result, key, __),
|
|
860
860
|
thunkify3(_mapMapSeriesAsync, iterator, f, result),
|
|
861
861
|
))
|
|
862
862
|
}
|
|
863
|
-
result.set(key,
|
|
863
|
+
result.set(key, resultElement)
|
|
864
864
|
iteration = iterator.next()
|
|
865
865
|
}
|
|
866
866
|
return result
|
|
@@ -881,14 +881,14 @@ const arrayMapPoolAsync = async function (
|
|
|
881
881
|
if (promises.size >= concurrencyLimit) {
|
|
882
882
|
await promiseRace(promises)
|
|
883
883
|
}
|
|
884
|
-
const
|
|
885
|
-
if (isPromise(
|
|
886
|
-
const selfDeletingPromise =
|
|
884
|
+
const resultElement = f(array[index])
|
|
885
|
+
if (isPromise(resultElement)) {
|
|
886
|
+
const selfDeletingPromise = resultElement.then(
|
|
887
887
|
tapSync(() => promises.delete(selfDeletingPromise)))
|
|
888
888
|
promises.add(selfDeletingPromise)
|
|
889
889
|
result[index] = selfDeletingPromise
|
|
890
890
|
} else {
|
|
891
|
-
result[index] =
|
|
891
|
+
result[index] = resultElement
|
|
892
892
|
}
|
|
893
893
|
}
|
|
894
894
|
return promiseAll(result)
|
|
@@ -899,17 +899,17 @@ const arrayMapPool = function (array, concurrency, f) {
|
|
|
899
899
|
result = Array(arrayLength)
|
|
900
900
|
let index = -1
|
|
901
901
|
while (++index < arrayLength) {
|
|
902
|
-
const
|
|
903
|
-
if (isPromise(
|
|
902
|
+
const resultElement = f(array[index])
|
|
903
|
+
if (isPromise(resultElement)) {
|
|
904
904
|
const promises = new Set(),
|
|
905
|
-
selfDeletingPromise =
|
|
905
|
+
selfDeletingPromise = resultElement.then(
|
|
906
906
|
tapSync(() => promises.delete(selfDeletingPromise)))
|
|
907
907
|
promises.add(selfDeletingPromise)
|
|
908
908
|
result[index] = selfDeletingPromise
|
|
909
909
|
return arrayMapPoolAsync(
|
|
910
910
|
array, f, concurrency, result, index, promises)
|
|
911
911
|
}
|
|
912
|
-
result[index] =
|
|
912
|
+
result[index] = resultElement
|
|
913
913
|
}
|
|
914
914
|
return result
|
|
915
915
|
}
|
|
@@ -929,15 +929,15 @@ const _setMapPoolAsync = async function (
|
|
|
929
929
|
if (promises.size >= concurrency) {
|
|
930
930
|
await promiseRace(promises)
|
|
931
931
|
}
|
|
932
|
-
const
|
|
933
|
-
if (isPromise(
|
|
934
|
-
const selfDeletingPromise =
|
|
932
|
+
const resultElement = f(iteration.value, iteration.value, s)
|
|
933
|
+
if (isPromise(resultElement)) {
|
|
934
|
+
const selfDeletingPromise = resultElement.then(resolvedValue => {
|
|
935
935
|
promises.delete(selfDeletingPromise)
|
|
936
936
|
result.add(resolvedValue)
|
|
937
937
|
})
|
|
938
938
|
promises.add(selfDeletingPromise)
|
|
939
939
|
} else {
|
|
940
|
-
result.add(
|
|
940
|
+
result.add(resultElement)
|
|
941
941
|
}
|
|
942
942
|
iteration = iterator.next()
|
|
943
943
|
}
|
|
@@ -952,17 +952,17 @@ const setMapPool = function (s, concurrency, f) {
|
|
|
952
952
|
const iterator = s[symbolIterator]()
|
|
953
953
|
let iteration = iterator.next()
|
|
954
954
|
while (!iteration.done) {
|
|
955
|
-
const
|
|
956
|
-
if (isPromise(
|
|
955
|
+
const resultElement = f(iteration.value, iteration.value, s)
|
|
956
|
+
if (isPromise(resultElement)) {
|
|
957
957
|
const promises = new Set()
|
|
958
|
-
const selfDeletingPromise =
|
|
958
|
+
const selfDeletingPromise = resultElement.then(resolvedValue => {
|
|
959
959
|
promises.delete(selfDeletingPromise)
|
|
960
960
|
result.add(resolvedValue)
|
|
961
961
|
})
|
|
962
962
|
promises.add(selfDeletingPromise)
|
|
963
963
|
return _setMapPoolAsync(s, iterator, concurrency, f, result, promises)
|
|
964
964
|
}
|
|
965
|
-
result.add(
|
|
965
|
+
result.add(resultElement)
|
|
966
966
|
iteration = iterator.next()
|
|
967
967
|
}
|
|
968
968
|
return result
|
|
@@ -977,16 +977,16 @@ const _mapMapPoolAsync = async function (
|
|
|
977
977
|
await promiseRace(promises)
|
|
978
978
|
}
|
|
979
979
|
const key = iteration.value[0]
|
|
980
|
-
const
|
|
981
|
-
if (isPromise(
|
|
982
|
-
result.set(key,
|
|
983
|
-
const selfDeletingPromise =
|
|
980
|
+
const resultElement = f(iteration.value[1], key, m)
|
|
981
|
+
if (isPromise(resultElement)) {
|
|
982
|
+
result.set(key, resultElement)
|
|
983
|
+
const selfDeletingPromise = resultElement.then(resolvedValue => {
|
|
984
984
|
promises.delete(selfDeletingPromise)
|
|
985
985
|
result.set(key, resolvedValue)
|
|
986
986
|
})
|
|
987
987
|
promises.add(selfDeletingPromise)
|
|
988
988
|
} else {
|
|
989
|
-
result.set(key,
|
|
989
|
+
result.set(key, resultElement)
|
|
990
990
|
}
|
|
991
991
|
iteration = iterator.next()
|
|
992
992
|
}
|
|
@@ -1002,18 +1002,18 @@ const mapMapPool = function (m, concurrency, f) {
|
|
|
1002
1002
|
let iteration = iterator.next()
|
|
1003
1003
|
while (!iteration.done) {
|
|
1004
1004
|
const key = iteration.value[0]
|
|
1005
|
-
const
|
|
1006
|
-
if (isPromise(
|
|
1005
|
+
const resultElement = f(iteration.value[1], key, m)
|
|
1006
|
+
if (isPromise(resultElement)) {
|
|
1007
1007
|
const promises = new Set()
|
|
1008
|
-
result.set(key,
|
|
1009
|
-
const selfDeletingPromise =
|
|
1008
|
+
result.set(key, resultElement)
|
|
1009
|
+
const selfDeletingPromise = resultElement.then(resolvedValue => {
|
|
1010
1010
|
promises.delete(selfDeletingPromise)
|
|
1011
1011
|
result.set(key, resolvedValue)
|
|
1012
1012
|
})
|
|
1013
1013
|
promises.add(selfDeletingPromise)
|
|
1014
1014
|
return _mapMapPoolAsync(m, iterator, concurrency, f, result, promises)
|
|
1015
1015
|
}
|
|
1016
|
-
result.set(key,
|
|
1016
|
+
result.set(key, resultElement)
|
|
1017
1017
|
iteration = iterator.next()
|
|
1018
1018
|
}
|
|
1019
1019
|
return result
|
|
@@ -1029,16 +1029,16 @@ const _objectMapPoolAsync = async function (
|
|
|
1029
1029
|
if (promises.size >= concurrency) {
|
|
1030
1030
|
await promiseRace(promises)
|
|
1031
1031
|
}
|
|
1032
|
-
const
|
|
1033
|
-
if (isPromise(
|
|
1034
|
-
result[key] =
|
|
1035
|
-
const selfDeletingPromise =
|
|
1032
|
+
const resultElement = f(o[key], key, o)
|
|
1033
|
+
if (isPromise(resultElement)) {
|
|
1034
|
+
result[key] = resultElement
|
|
1035
|
+
const selfDeletingPromise = resultElement.then(resolvedValue => {
|
|
1036
1036
|
promises.delete(selfDeletingPromise)
|
|
1037
1037
|
result[key] = resolvedValue
|
|
1038
1038
|
})
|
|
1039
1039
|
promises.add(selfDeletingPromise)
|
|
1040
1040
|
} else {
|
|
1041
|
-
result[key] =
|
|
1041
|
+
result[key] = resultElement
|
|
1042
1042
|
}
|
|
1043
1043
|
}
|
|
1044
1044
|
if (promises.size > 0) {
|
|
@@ -1052,18 +1052,18 @@ const objectMapPool = function (o, concurrency, f) {
|
|
|
1052
1052
|
const doneKeys = {}
|
|
1053
1053
|
for (const key in o) {
|
|
1054
1054
|
doneKeys[key] = true
|
|
1055
|
-
const
|
|
1056
|
-
if (isPromise(
|
|
1055
|
+
const resultElement = f(o[key], key, o)
|
|
1056
|
+
if (isPromise(resultElement)) {
|
|
1057
1057
|
const promises = new Set()
|
|
1058
|
-
result[key] =
|
|
1059
|
-
const selfDeletingPromise =
|
|
1058
|
+
result[key] = resultElement
|
|
1059
|
+
const selfDeletingPromise = resultElement.then(resolvedValue => {
|
|
1060
1060
|
promises.delete(selfDeletingPromise)
|
|
1061
1061
|
result[key] = resolvedValue
|
|
1062
1062
|
})
|
|
1063
1063
|
promises.add(selfDeletingPromise)
|
|
1064
1064
|
return _objectMapPoolAsync(o, concurrency, f, result, doneKeys, promises)
|
|
1065
1065
|
}
|
|
1066
|
-
result[key] =
|
|
1066
|
+
result[key] = resultElement
|
|
1067
1067
|
}
|
|
1068
1068
|
return result
|
|
1069
1069
|
}
|
|
@@ -1365,15 +1365,15 @@ const arrayFilter = function (array, predicate) {
|
|
|
1365
1365
|
let index = -1,
|
|
1366
1366
|
resultIndex = -1
|
|
1367
1367
|
while (++index < arrayLength) {
|
|
1368
|
-
const
|
|
1369
|
-
|
|
1370
|
-
if (isPromise(
|
|
1368
|
+
const element = array[index],
|
|
1369
|
+
shouldIncludeElement = predicate(element, index, array)
|
|
1370
|
+
if (isPromise(shouldIncludeElement)) {
|
|
1371
1371
|
return promiseAll(
|
|
1372
|
-
arrayExtendMap([
|
|
1372
|
+
arrayExtendMap([shouldIncludeElement], array, predicate, index)
|
|
1373
1373
|
).then(curry4(arrayFilterByConditions, array, result, index - 1, __))
|
|
1374
1374
|
}
|
|
1375
|
-
if (
|
|
1376
|
-
result[++resultIndex] =
|
|
1375
|
+
if (shouldIncludeElement) {
|
|
1376
|
+
result[++resultIndex] = element
|
|
1377
1377
|
}
|
|
1378
1378
|
}
|
|
1379
1379
|
return result
|
|
@@ -1396,13 +1396,13 @@ const setFilter = function (value, predicate) {
|
|
|
1396
1396
|
const result = new Set(),
|
|
1397
1397
|
resultAdd = result.add.bind(result),
|
|
1398
1398
|
promises = []
|
|
1399
|
-
for (const
|
|
1400
|
-
const predication = predicate(
|
|
1399
|
+
for (const element of value) {
|
|
1400
|
+
const predication = predicate(element, element, value)
|
|
1401
1401
|
if (isPromise(predication)) {
|
|
1402
1402
|
promises.push(predication.then(curry3(
|
|
1403
|
-
thunkConditional, __, thunkify1(resultAdd,
|
|
1403
|
+
thunkConditional, __, thunkify1(resultAdd, element), noop)))
|
|
1404
1404
|
} else if (predication) {
|
|
1405
|
-
result.add(
|
|
1405
|
+
result.add(element)
|
|
1406
1406
|
}
|
|
1407
1407
|
}
|
|
1408
1408
|
return promises.length == 0
|
|
@@ -1413,15 +1413,15 @@ const setFilter = function (value, predicate) {
|
|
|
1413
1413
|
const mapFilter = function (map, predicate) {
|
|
1414
1414
|
const result = new Map(),
|
|
1415
1415
|
promises = []
|
|
1416
|
-
for (const [key,
|
|
1417
|
-
const predication = predicate(
|
|
1416
|
+
for (const [key, element] of map) {
|
|
1417
|
+
const predication = predicate(element, key, map)
|
|
1418
1418
|
if (isPromise(predication)) {
|
|
1419
1419
|
promises.push(predication.then(curry3(thunkConditional,
|
|
1420
1420
|
__,
|
|
1421
|
-
thunkify4(callPropBinary, result, 'set', key,
|
|
1421
|
+
thunkify4(callPropBinary, result, 'set', key, element),
|
|
1422
1422
|
noop)))
|
|
1423
1423
|
} else if (predication) {
|
|
1424
|
-
result.set(key,
|
|
1424
|
+
result.set(key, element)
|
|
1425
1425
|
}
|
|
1426
1426
|
}
|
|
1427
1427
|
return promises.length == 0 ? result
|
|
@@ -1440,13 +1440,13 @@ const objectFilter = function (object, predicate) {
|
|
|
1440
1440
|
const result = {},
|
|
1441
1441
|
promises = []
|
|
1442
1442
|
for (const key in object) {
|
|
1443
|
-
const
|
|
1444
|
-
|
|
1445
|
-
if (isPromise(
|
|
1446
|
-
promises.push(
|
|
1443
|
+
const element = object[key],
|
|
1444
|
+
shouldIncludeElement = predicate(element, key, object)
|
|
1445
|
+
if (isPromise(shouldIncludeElement)) {
|
|
1446
|
+
promises.push(shouldIncludeElement.then(
|
|
1447
1447
|
curry4(objectSetIf, result, key, object[key], __)))
|
|
1448
|
-
} else if (
|
|
1449
|
-
result[key] =
|
|
1448
|
+
} else if (shouldIncludeElement) {
|
|
1449
|
+
result[key] = element
|
|
1450
1450
|
}
|
|
1451
1451
|
}
|
|
1452
1452
|
return promises.length == 0
|
|
@@ -1708,11 +1708,11 @@ const mapReduce = function (map, reducer, result) {
|
|
|
1708
1708
|
|
|
1709
1709
|
const reducerConcat = (
|
|
1710
1710
|
reducerA, reducerB,
|
|
1711
|
-
) => function pipedReducer(result,
|
|
1712
|
-
const intermediate = reducerA(result,
|
|
1711
|
+
) => function pipedReducer(result, element) {
|
|
1712
|
+
const intermediate = reducerA(result, element)
|
|
1713
1713
|
return isPromise(intermediate)
|
|
1714
|
-
? intermediate.then(curry2(reducerB, __,
|
|
1715
|
-
: reducerB(intermediate,
|
|
1714
|
+
? intermediate.then(curry2(reducerB, __, element))
|
|
1715
|
+
: reducerB(intermediate, element)
|
|
1716
1716
|
}
|
|
1717
1717
|
|
|
1718
1718
|
const genericReduce = function (collection, reducer, result) {
|
|
@@ -1952,7 +1952,7 @@ const FlatMappingIterator = function (iterator, flatMapper) {
|
|
|
1952
1952
|
const monadAsArray = genericReduce(
|
|
1953
1953
|
flatMapper(iteration.value),
|
|
1954
1954
|
arrayPush,
|
|
1955
|
-
[]) // this will always have at least one
|
|
1955
|
+
[]) // this will always have at least one element
|
|
1956
1956
|
if (monadAsArray.length > 1) {
|
|
1957
1957
|
buffer = monadAsArray
|
|
1958
1958
|
bufferIndex = 1
|
|
@@ -2031,8 +2031,8 @@ const funcConcatSync = (
|
|
|
2031
2031
|
|
|
2032
2032
|
const asyncIteratorForEach = async function (asyncIterator, callback) {
|
|
2033
2033
|
const promises = []
|
|
2034
|
-
for await (const
|
|
2035
|
-
const operation = callback(
|
|
2034
|
+
for await (const element of asyncIterator) {
|
|
2035
|
+
const operation = callback(element)
|
|
2036
2036
|
if (isPromise(operation)) {
|
|
2037
2037
|
promises.push(operation)
|
|
2038
2038
|
}
|
|
@@ -2048,44 +2048,44 @@ const arrayFlatten = function (array) {
|
|
|
2048
2048
|
let index = -1
|
|
2049
2049
|
|
|
2050
2050
|
while (++index < length) {
|
|
2051
|
-
const
|
|
2052
|
-
if (isArray(
|
|
2053
|
-
const
|
|
2054
|
-
let
|
|
2055
|
-
while (++
|
|
2056
|
-
result.push(
|
|
2051
|
+
const element = array[index]
|
|
2052
|
+
if (isArray(element)) {
|
|
2053
|
+
const elementLength = element.length
|
|
2054
|
+
let elementIndex = -1
|
|
2055
|
+
while (++elementIndex < elementLength) {
|
|
2056
|
+
result.push(element[elementIndex])
|
|
2057
2057
|
}
|
|
2058
|
-
} else if (
|
|
2059
|
-
result.push(
|
|
2060
|
-
} else if (typeof
|
|
2061
|
-
promises.push(
|
|
2062
|
-
} else if (typeof
|
|
2063
|
-
for (const
|
|
2064
|
-
result.push(
|
|
2058
|
+
} else if (element == null) {
|
|
2059
|
+
result.push(element)
|
|
2060
|
+
} else if (typeof element.then == 'function') {
|
|
2061
|
+
promises.push(element.then(curry2(arrayPush, result, __)))
|
|
2062
|
+
} else if (typeof element[symbolIterator] == 'function') {
|
|
2063
|
+
for (const subElement of element) {
|
|
2064
|
+
result.push(subElement)
|
|
2065
2065
|
}
|
|
2066
|
-
} else if (typeof
|
|
2066
|
+
} else if (typeof element[symbolAsyncIterator] == 'function') {
|
|
2067
2067
|
promises.push(asyncIteratorForEach(
|
|
2068
|
-
|
|
2069
|
-
} else if (typeof
|
|
2070
|
-
const monadValue =
|
|
2068
|
+
element[symbolAsyncIterator](), curry2(arrayPush, result, __)))
|
|
2069
|
+
} else if (typeof element.chain == 'function') {
|
|
2070
|
+
const monadValue = element.chain(identity)
|
|
2071
2071
|
isPromise(monadValue)
|
|
2072
2072
|
? promises.push(monadValue.then(curry2(arrayPush, result, __)))
|
|
2073
2073
|
: result.push(monadValue)
|
|
2074
|
-
} else if (typeof
|
|
2075
|
-
const monadValue =
|
|
2074
|
+
} else if (typeof element.flatMap == 'function') {
|
|
2075
|
+
const monadValue = element.flatMap(identity)
|
|
2076
2076
|
isPromise(monadValue)
|
|
2077
2077
|
? promises.push(monadValue.then(curry2(arrayPush, result, __)))
|
|
2078
2078
|
: result.push(monadValue)
|
|
2079
|
-
} else if (typeof
|
|
2080
|
-
const folded =
|
|
2079
|
+
} else if (typeof element.reduce == 'function') {
|
|
2080
|
+
const folded = element.reduce(funcConcatSync(
|
|
2081
2081
|
getArg1, curry2(arrayPush, result, __)), null)
|
|
2082
2082
|
isPromise(folded) && promises.push(folded)
|
|
2083
|
-
} else if (
|
|
2084
|
-
for (const key in
|
|
2085
|
-
result.push(
|
|
2083
|
+
} else if (element.constructor == Object) {
|
|
2084
|
+
for (const key in element) {
|
|
2085
|
+
result.push(element[key])
|
|
2086
2086
|
}
|
|
2087
2087
|
} else {
|
|
2088
|
-
result.push(
|
|
2088
|
+
result.push(element)
|
|
2089
2089
|
}
|
|
2090
2090
|
}
|
|
2091
2091
|
return promises.length == 0
|
|
@@ -2108,31 +2108,31 @@ const objectFlatten = function (object) {
|
|
|
2108
2108
|
getResult = () => result
|
|
2109
2109
|
|
|
2110
2110
|
for (const key in object) {
|
|
2111
|
-
const
|
|
2112
|
-
if (
|
|
2111
|
+
const element = object[key]
|
|
2112
|
+
if (element == null) {
|
|
2113
2113
|
continue
|
|
2114
|
-
} else if (typeof
|
|
2115
|
-
for (const
|
|
2116
|
-
objectAssign(result,
|
|
2114
|
+
} else if (typeof element[symbolIterator] == 'function') {
|
|
2115
|
+
for (const monadElement of element) {
|
|
2116
|
+
objectAssign(result, monadElement)
|
|
2117
2117
|
}
|
|
2118
|
-
} else if (typeof
|
|
2118
|
+
} else if (typeof element[symbolAsyncIterator] == 'function') {
|
|
2119
2119
|
promises.push(
|
|
2120
|
-
asyncIteratorForEach(
|
|
2121
|
-
} else if (typeof
|
|
2122
|
-
const monadValue =
|
|
2120
|
+
asyncIteratorForEach(element[symbolAsyncIterator](), resultAssign))
|
|
2121
|
+
} else if (typeof element.chain == 'function') {
|
|
2122
|
+
const monadValue = element.chain(identity)
|
|
2123
2123
|
isPromise(monadValue)
|
|
2124
2124
|
? promises.push(monadValue.then(resultAssign))
|
|
2125
2125
|
: objectAssign(result, monadValue)
|
|
2126
|
-
} else if (typeof
|
|
2127
|
-
const monadValue =
|
|
2126
|
+
} else if (typeof element.flatMap == 'function') {
|
|
2127
|
+
const monadValue = element.flatMap(identity)
|
|
2128
2128
|
isPromise(monadValue)
|
|
2129
2129
|
? promises.push(monadValue.then(resultAssign))
|
|
2130
2130
|
: resultAssign(monadValue)
|
|
2131
|
-
} else if (typeof
|
|
2132
|
-
const folded =
|
|
2131
|
+
} else if (typeof element.reduce == 'function') {
|
|
2132
|
+
const folded = element.reduce(resultAssignReducer, null)
|
|
2133
2133
|
isPromise(folded) && promises.push(folded)
|
|
2134
2134
|
} else {
|
|
2135
|
-
objectAssign(result,
|
|
2135
|
+
objectAssign(result, element)
|
|
2136
2136
|
}
|
|
2137
2137
|
}
|
|
2138
2138
|
return promises.length == 0
|
|
@@ -2151,45 +2151,45 @@ const setFlatten = function (set) {
|
|
|
2151
2151
|
const size = set.size,
|
|
2152
2152
|
promises = [],
|
|
2153
2153
|
result = new Set(),
|
|
2154
|
-
resultAddReducer = (_,
|
|
2154
|
+
resultAddReducer = (_, subElement) => result.add(subElement),
|
|
2155
2155
|
resultAdd = curry3(callPropUnary, result, 'add', __),
|
|
2156
2156
|
getResult = () => result
|
|
2157
2157
|
|
|
2158
|
-
for (const
|
|
2159
|
-
if (isArray(
|
|
2160
|
-
const
|
|
2161
|
-
let
|
|
2162
|
-
while (++
|
|
2163
|
-
result.add(
|
|
2158
|
+
for (const element of set) {
|
|
2159
|
+
if (isArray(element)) {
|
|
2160
|
+
const elementLength = element.length
|
|
2161
|
+
let elementIndex = -1
|
|
2162
|
+
while (++elementIndex < elementLength) {
|
|
2163
|
+
result.add(element[elementIndex])
|
|
2164
2164
|
}
|
|
2165
|
-
} else if (
|
|
2166
|
-
result.add(
|
|
2167
|
-
} else if (typeof
|
|
2168
|
-
for (const
|
|
2169
|
-
result.add(
|
|
2165
|
+
} else if (element == null) {
|
|
2166
|
+
result.add(element)
|
|
2167
|
+
} else if (typeof element[symbolIterator] == 'function') {
|
|
2168
|
+
for (const subElement of element) {
|
|
2169
|
+
result.add(subElement)
|
|
2170
2170
|
}
|
|
2171
|
-
} else if (typeof
|
|
2171
|
+
} else if (typeof element[symbolAsyncIterator] == 'function') {
|
|
2172
2172
|
promises.push(
|
|
2173
|
-
asyncIteratorForEach(
|
|
2174
|
-
} else if (typeof
|
|
2175
|
-
const monadValue =
|
|
2173
|
+
asyncIteratorForEach(element[symbolAsyncIterator](), resultAdd))
|
|
2174
|
+
} else if (typeof element.chain == 'function') {
|
|
2175
|
+
const monadValue = element.chain(identity)
|
|
2176
2176
|
isPromise(monadValue)
|
|
2177
2177
|
? promises.push(monadValue.then(resultAdd))
|
|
2178
2178
|
: result.add(monadValue)
|
|
2179
|
-
} else if (typeof
|
|
2180
|
-
const monadValue =
|
|
2179
|
+
} else if (typeof element.flatMap == 'function') {
|
|
2180
|
+
const monadValue = element.flatMap(identity)
|
|
2181
2181
|
isPromise(monadValue)
|
|
2182
2182
|
? promises.push(monadValue.then(resultAdd))
|
|
2183
2183
|
: result.add(monadValue)
|
|
2184
|
-
} else if (typeof
|
|
2185
|
-
const folded =
|
|
2184
|
+
} else if (typeof element.reduce == 'function') {
|
|
2185
|
+
const folded = element.reduce(resultAddReducer, null)
|
|
2186
2186
|
isPromise(folded) && promises.push(folded)
|
|
2187
|
-
} else if (
|
|
2188
|
-
for (const key in
|
|
2189
|
-
result.add(
|
|
2187
|
+
} else if (element.constructor == Object) {
|
|
2188
|
+
for (const key in element) {
|
|
2189
|
+
result.add(element[key])
|
|
2190
2190
|
}
|
|
2191
2191
|
} else {
|
|
2192
|
-
result.add(
|
|
2192
|
+
result.add(element)
|
|
2193
2193
|
}
|
|
2194
2194
|
}
|
|
2195
2195
|
return promises.length == 0 ? result : promiseAll(promises).then(getResult)
|
|
@@ -2285,8 +2285,8 @@ const objectForEach = function (object, callback) {
|
|
|
2285
2285
|
|
|
2286
2286
|
const iteratorForEach = function (iterator, callback) {
|
|
2287
2287
|
const promises = []
|
|
2288
|
-
for (const
|
|
2289
|
-
const operation = callback(
|
|
2288
|
+
for (const element of iterator) {
|
|
2289
|
+
const operation = callback(element)
|
|
2290
2290
|
if (isPromise(operation)) {
|
|
2291
2291
|
promises.push(operation)
|
|
2292
2292
|
}
|
|
@@ -2384,8 +2384,8 @@ const iteratorForEachSeries = function (iterator, callback) {
|
|
|
2384
2384
|
}
|
|
2385
2385
|
|
|
2386
2386
|
const asyncIteratorForEachSeries = async function (asyncIterator, callback) {
|
|
2387
|
-
for await (const
|
|
2388
|
-
const operation = callback(
|
|
2387
|
+
for await (const element of asyncIterator) {
|
|
2388
|
+
const operation = callback(element)
|
|
2389
2389
|
if (isPromise(operation)) {
|
|
2390
2390
|
await operation
|
|
2391
2391
|
}
|
|
@@ -2537,8 +2537,8 @@ const asyncIteratorSome = async function (
|
|
|
2537
2537
|
}
|
|
2538
2538
|
|
|
2539
2539
|
const iteratorSome = function (iterator, predicate) {
|
|
2540
|
-
for (const
|
|
2541
|
-
const predication = predicate(
|
|
2540
|
+
for (const element of iterator) {
|
|
2541
|
+
const predication = predicate(element)
|
|
2542
2542
|
if (isPromise(predication)) {
|
|
2543
2543
|
return asyncIteratorSome(
|
|
2544
2544
|
iterator, predicate, new Set([SelfReferencingPromise(predication)]))
|
|
@@ -2550,14 +2550,14 @@ const iteratorSome = function (iterator, predicate) {
|
|
|
2550
2550
|
return false
|
|
2551
2551
|
}
|
|
2552
2552
|
|
|
2553
|
-
const reducerAnySync = predicate => function anyReducer(result,
|
|
2554
|
-
return result ? true : predicate(
|
|
2553
|
+
const reducerAnySync = predicate => function anyReducer(result, element) {
|
|
2554
|
+
return result ? true : predicate(element)
|
|
2555
2555
|
}
|
|
2556
2556
|
|
|
2557
|
-
const reducerSome = predicate => function anyReducer(result,
|
|
2557
|
+
const reducerSome = predicate => function anyReducer(result, element) {
|
|
2558
2558
|
return result === true ? result
|
|
2559
|
-
: isPromise(result) ? result.then(curry2(reducerAnySync(predicate), __,
|
|
2560
|
-
: result ? true : predicate(
|
|
2559
|
+
: isPromise(result) ? result.then(curry2(reducerAnySync(predicate), __, element))
|
|
2560
|
+
: result ? true : predicate(element)
|
|
2561
2561
|
}
|
|
2562
2562
|
|
|
2563
2563
|
// _some(collection Array|Iterable|AsyncIterable|{ reduce: function }|Object, predicate function) -> Promise|boolean
|
|
@@ -2613,8 +2613,8 @@ const arrayEvery = function (array, predicate) {
|
|
|
2613
2613
|
|
|
2614
2614
|
const iteratorEvery = function (iterator, predicate) {
|
|
2615
2615
|
const promises = []
|
|
2616
|
-
for (const
|
|
2617
|
-
const predication = predicate(
|
|
2616
|
+
for (const element of iterator) {
|
|
2617
|
+
const predication = predicate(element)
|
|
2618
2618
|
if (isPromise(predication)) {
|
|
2619
2619
|
promises.push(predication)
|
|
2620
2620
|
} else if (!predication) {
|
|
@@ -2657,13 +2657,13 @@ const asyncIteratorEvery = async function (
|
|
|
2657
2657
|
return true
|
|
2658
2658
|
}
|
|
2659
2659
|
|
|
2660
|
-
const reducerAllSync = (predicate, result,
|
|
2660
|
+
const reducerAllSync = (predicate, result, element) => result ? predicate(element) : false
|
|
2661
2661
|
|
|
2662
|
-
const reducerEvery = predicate => function allReducer(result,
|
|
2662
|
+
const reducerEvery = predicate => function allReducer(result, element) {
|
|
2663
2663
|
return result === false ? false
|
|
2664
2664
|
: isPromise(result) ? result.then(
|
|
2665
|
-
curry3(reducerAllSync, predicate, __,
|
|
2666
|
-
: result ? predicate(
|
|
2665
|
+
curry3(reducerAllSync, predicate, __, element))
|
|
2666
|
+
: result ? predicate(element) : false
|
|
2667
2667
|
}
|
|
2668
2668
|
|
|
2669
2669
|
// _every(collection Array|Iterable|AsyncIterable|{ reduce: function }|Object, predicate function) -> Promise|boolean
|
|
@@ -3220,13 +3220,13 @@ const deleteByPath = function (object, path) {
|
|
|
3220
3220
|
const objectCopyDeep = function (object) {
|
|
3221
3221
|
const result = {}
|
|
3222
3222
|
for (const key in object) {
|
|
3223
|
-
const
|
|
3224
|
-
if (isArray(
|
|
3225
|
-
result[key] = arrayCopyDeep(
|
|
3226
|
-
} else if (
|
|
3227
|
-
result[key] = objectCopyDeep(
|
|
3223
|
+
const element = object[key]
|
|
3224
|
+
if (isArray(element)) {
|
|
3225
|
+
result[key] = arrayCopyDeep(element)
|
|
3226
|
+
} else if (element != null && element.constructor == Object) {
|
|
3227
|
+
result[key] = objectCopyDeep(element)
|
|
3228
3228
|
} else {
|
|
3229
|
-
result[key] =
|
|
3229
|
+
result[key] = element
|
|
3230
3230
|
}
|
|
3231
3231
|
}
|
|
3232
3232
|
return result
|
|
@@ -3238,13 +3238,13 @@ const arrayCopyDeep = function (array) {
|
|
|
3238
3238
|
result = []
|
|
3239
3239
|
let index = -1
|
|
3240
3240
|
while (++index < length) {
|
|
3241
|
-
const
|
|
3242
|
-
if (isArray(
|
|
3243
|
-
result[index] = arrayCopyDeep(
|
|
3244
|
-
} else if (
|
|
3245
|
-
result[index] = objectCopyDeep(
|
|
3241
|
+
const element = array[index]
|
|
3242
|
+
if (isArray(element)) {
|
|
3243
|
+
result[index] = arrayCopyDeep(element)
|
|
3244
|
+
} else if (element != null && element.constructor == Object) {
|
|
3245
|
+
result[index] = objectCopyDeep(element)
|
|
3246
3246
|
} else {
|
|
3247
|
-
result[index] =
|
|
3247
|
+
result[index] = element
|
|
3248
3248
|
}
|
|
3249
3249
|
}
|
|
3250
3250
|
return result
|