rubico 2.5.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_internal/arrayMapPool.js +11 -19
- package/_internal/mapMapPool.js +80 -0
- package/_internal/objectMapPool.js +77 -0
- package/_internal/objectMapSeries.js +1 -0
- package/_internal/setMapPool.js +79 -0
- package/_internal/stringMapPool.js +22 -0
- package/all.js +11 -1
- package/and.js +9 -0
- package/assign.js +14 -1
- package/compose.js +8 -0
- package/dist/Transducer.es.js +1 -1
- package/dist/Transducer.es.min.js +1 -1
- package/dist/Transducer.js +1 -1
- package/dist/Transducer.min.js +1 -1
- package/dist/Transducer.mjs +1 -1
- package/dist/__.es.js +1 -1
- package/dist/__.es.min.js +1 -1
- package/dist/__.js +1 -1
- package/dist/__.min.js +1 -1
- package/dist/__.mjs +1 -1
- package/dist/all.es.js +1 -1
- package/dist/all.es.min.js +1 -1
- package/dist/all.js +1 -1
- package/dist/all.min.js +1 -1
- package/dist/all.mjs +1 -1
- package/dist/always.es.js +1 -1
- package/dist/always.es.min.js +1 -1
- package/dist/always.js +1 -1
- package/dist/always.min.js +1 -1
- package/dist/always.mjs +1 -1
- package/dist/and.es.js +1 -1
- package/dist/and.es.min.js +1 -1
- package/dist/and.js +1 -1
- package/dist/and.min.js +1 -1
- package/dist/and.mjs +1 -1
- package/dist/assign.es.js +1 -1
- package/dist/assign.es.min.js +1 -1
- package/dist/assign.js +1 -1
- package/dist/assign.min.js +1 -1
- package/dist/assign.mjs +1 -1
- package/dist/compose.es.js +1 -1
- package/dist/compose.es.min.js +1 -1
- package/dist/compose.js +1 -1
- package/dist/compose.min.js +1 -1
- package/dist/compose.mjs +1 -1
- package/dist/curry.es.js +1 -1
- package/dist/curry.es.min.js +1 -1
- package/dist/curry.js +1 -1
- package/dist/curry.min.js +1 -1
- package/dist/curry.mjs +1 -1
- package/dist/eq.es.js +1 -1
- package/dist/eq.es.min.js +1 -1
- package/dist/eq.js +1 -1
- package/dist/eq.min.js +1 -1
- package/dist/eq.mjs +1 -1
- package/dist/every.es.js +1 -1
- package/dist/every.es.min.js +1 -1
- package/dist/every.js +1 -1
- package/dist/every.min.js +1 -1
- package/dist/every.mjs +1 -1
- package/dist/filter.es.js +1 -1
- package/dist/filter.es.min.js +1 -1
- package/dist/filter.js +1 -1
- package/dist/filter.min.js +1 -1
- package/dist/filter.mjs +1 -1
- package/dist/flatMap.es.js +1 -1
- package/dist/flatMap.es.min.js +1 -1
- package/dist/flatMap.js +1 -1
- package/dist/flatMap.min.js +1 -1
- package/dist/flatMap.mjs +1 -1
- package/dist/forEach.es.js +3 -2
- package/dist/forEach.es.min.js +2 -2
- package/dist/forEach.js +3 -2
- package/dist/forEach.min.js +2 -2
- package/dist/forEach.mjs +3 -2
- 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 +221 -44
- package/dist/map.es.min.js +2 -2
- package/dist/map.js +221 -44
- package/dist/map.min.js +2 -2
- package/dist/map.mjs +221 -44
- package/dist/not.es.js +1 -1
- package/dist/not.es.min.js +1 -1
- package/dist/not.js +1 -1
- package/dist/not.min.js +1 -1
- package/dist/not.mjs +1 -1
- package/dist/omit.es.js +1 -1
- package/dist/omit.es.min.js +1 -1
- package/dist/omit.js +1 -1
- package/dist/omit.min.js +1 -1
- package/dist/omit.mjs +1 -1
- package/dist/or.es.js +1 -1
- package/dist/or.es.min.js +1 -1
- package/dist/or.js +1 -1
- package/dist/or.min.js +1 -1
- package/dist/or.mjs +1 -1
- package/dist/pick.es.js +1 -1
- package/dist/pick.es.min.js +1 -1
- package/dist/pick.js +1 -1
- package/dist/pick.min.js +1 -1
- package/dist/pick.mjs +1 -1
- package/dist/pipe.es.js +1 -1
- package/dist/pipe.es.min.js +1 -1
- package/dist/pipe.js +1 -1
- package/dist/pipe.min.js +1 -1
- package/dist/pipe.mjs +1 -1
- package/dist/reduce.es.js +1 -1
- package/dist/reduce.es.min.js +1 -1
- package/dist/reduce.js +1 -1
- package/dist/reduce.min.js +1 -1
- package/dist/reduce.mjs +1 -1
- package/dist/rubico.es.js +197 -16
- package/dist/rubico.es.min.js +2 -2
- package/dist/rubico.global.js +197 -16
- package/dist/rubico.global.min.js +2 -2
- package/dist/rubico.js +197 -16
- package/dist/rubico.min.js +2 -2
- package/dist/rubico.mjs +197 -16
- package/dist/set.es.js +1 -1
- package/dist/set.es.min.js +1 -1
- package/dist/set.js +1 -1
- package/dist/set.min.js +1 -1
- package/dist/set.mjs +1 -1
- package/dist/some.es.js +1 -1
- package/dist/some.es.min.js +1 -1
- package/dist/some.js +1 -1
- package/dist/some.min.js +1 -1
- package/dist/some.mjs +1 -1
- package/dist/switchCase.es.js +1 -1
- package/dist/switchCase.es.min.js +1 -1
- package/dist/switchCase.js +1 -1
- package/dist/switchCase.min.js +1 -1
- package/dist/switchCase.mjs +1 -1
- package/dist/tap.es.js +38 -1
- package/dist/tap.es.min.js +2 -2
- package/dist/tap.js +38 -1
- package/dist/tap.min.js +2 -2
- package/dist/tap.mjs +38 -1
- package/dist/thunkify.es.js +1 -1
- package/dist/thunkify.es.min.js +1 -1
- package/dist/thunkify.js +1 -1
- package/dist/thunkify.min.js +1 -1
- package/dist/thunkify.mjs +1 -1
- package/dist/transform.es.js +1 -1
- package/dist/transform.es.min.js +1 -1
- package/dist/transform.js +1 -1
- package/dist/transform.min.js +1 -1
- package/dist/transform.mjs +1 -1
- package/dist/tryCatch.es.js +1 -1
- package/dist/tryCatch.es.min.js +1 -1
- package/dist/tryCatch.js +1 -1
- package/dist/tryCatch.min.js +1 -1
- package/dist/tryCatch.mjs +1 -1
- package/dist/x/append.es.js +1 -1
- package/dist/x/append.es.min.js +1 -1
- package/dist/x/append.js +1 -1
- package/dist/x/append.min.js +1 -1
- package/dist/x/append.mjs +1 -1
- package/dist/x/callProp.es.js +1 -1
- package/dist/x/callProp.es.min.js +1 -1
- package/dist/x/callProp.js +1 -1
- package/dist/x/callProp.min.js +1 -1
- package/dist/x/callProp.mjs +1 -1
- package/dist/x/defaultsDeep.es.js +1 -1
- package/dist/x/defaultsDeep.es.min.js +1 -1
- package/dist/x/defaultsDeep.js +1 -1
- package/dist/x/defaultsDeep.min.js +1 -1
- package/dist/x/defaultsDeep.mjs +1 -1
- package/dist/x/differenceWith.es.js +1 -1
- package/dist/x/differenceWith.es.min.js +1 -1
- package/dist/x/differenceWith.js +1 -1
- package/dist/x/differenceWith.min.js +1 -1
- package/dist/x/differenceWith.mjs +1 -1
- package/dist/x/filterOut.es.js +1 -1
- package/dist/x/filterOut.es.min.js +1 -1
- package/dist/x/filterOut.js +1 -1
- package/dist/x/filterOut.min.js +1 -1
- package/dist/x/filterOut.mjs +1 -1
- package/dist/x/find.es.js +1 -1
- package/dist/x/find.es.min.js +1 -1
- package/dist/x/find.js +1 -1
- package/dist/x/find.min.js +1 -1
- package/dist/x/find.mjs +1 -1
- package/dist/x/findIndex.es.js +1 -1
- package/dist/x/findIndex.es.min.js +1 -1
- package/dist/x/findIndex.js +1 -1
- package/dist/x/findIndex.min.js +1 -1
- package/dist/x/findIndex.mjs +1 -1
- package/dist/x/first.es.js +1 -1
- package/dist/x/first.es.min.js +1 -1
- package/dist/x/first.js +1 -1
- package/dist/x/first.min.js +1 -1
- package/dist/x/first.mjs +1 -1
- package/dist/x/flatten.es.js +1 -1
- package/dist/x/flatten.es.min.js +1 -1
- package/dist/x/flatten.js +1 -1
- package/dist/x/flatten.min.js +1 -1
- package/dist/x/flatten.mjs +1 -1
- package/dist/x/groupBy.es.js +1 -1
- package/dist/x/groupBy.es.min.js +1 -1
- package/dist/x/groupBy.js +1 -1
- package/dist/x/groupBy.min.js +1 -1
- package/dist/x/groupBy.mjs +1 -1
- package/dist/x/has.es.js +1 -1
- package/dist/x/has.es.min.js +1 -1
- package/dist/x/has.js +1 -1
- package/dist/x/has.min.js +1 -1
- package/dist/x/has.mjs +1 -1
- package/dist/x/identity.es.js +1 -1
- package/dist/x/identity.es.min.js +1 -1
- package/dist/x/identity.js +1 -1
- package/dist/x/identity.min.js +1 -1
- package/dist/x/identity.mjs +1 -1
- package/dist/x/includes.es.js +1 -1
- package/dist/x/includes.es.min.js +1 -1
- package/dist/x/includes.js +1 -1
- package/dist/x/includes.min.js +1 -1
- package/dist/x/includes.mjs +1 -1
- package/dist/x/isDeepEqual.es.js +1 -1
- package/dist/x/isDeepEqual.es.min.js +1 -1
- package/dist/x/isDeepEqual.js +1 -1
- package/dist/x/isDeepEqual.min.js +1 -1
- package/dist/x/isDeepEqual.mjs +1 -1
- package/dist/x/isEmpty.es.js +1 -1
- package/dist/x/isEmpty.es.min.js +1 -1
- package/dist/x/isEmpty.js +1 -1
- package/dist/x/isEmpty.min.js +1 -1
- package/dist/x/isEmpty.mjs +1 -1
- package/dist/x/isEqual.es.js +1 -1
- package/dist/x/isEqual.es.min.js +1 -1
- package/dist/x/isEqual.js +1 -1
- package/dist/x/isEqual.min.js +1 -1
- package/dist/x/isEqual.mjs +1 -1
- package/dist/x/isFunction.es.js +1 -1
- package/dist/x/isFunction.es.min.js +1 -1
- package/dist/x/isFunction.js +1 -1
- package/dist/x/isFunction.min.js +1 -1
- package/dist/x/isFunction.mjs +1 -1
- package/dist/x/isIn.es.js +1 -1
- package/dist/x/isIn.es.min.js +1 -1
- package/dist/x/isIn.js +1 -1
- package/dist/x/isIn.min.js +1 -1
- package/dist/x/isIn.mjs +1 -1
- package/dist/x/isObject.es.js +1 -1
- package/dist/x/isObject.es.min.js +1 -1
- package/dist/x/isObject.js +1 -1
- package/dist/x/isObject.min.js +1 -1
- package/dist/x/isObject.mjs +1 -1
- package/dist/x/isString.es.js +1 -1
- package/dist/x/isString.es.min.js +1 -1
- package/dist/x/isString.js +1 -1
- package/dist/x/isString.min.js +1 -1
- package/dist/x/isString.mjs +1 -1
- package/dist/x/keys.es.js +1 -1
- package/dist/x/keys.es.min.js +1 -1
- package/dist/x/keys.js +1 -1
- package/dist/x/keys.min.js +1 -1
- package/dist/x/keys.mjs +1 -1
- package/dist/x/last.es.js +1 -1
- package/dist/x/last.es.min.js +1 -1
- package/dist/x/last.js +1 -1
- package/dist/x/last.min.js +1 -1
- package/dist/x/last.mjs +1 -1
- package/dist/x/maxBy.es.js +1 -1
- package/dist/x/maxBy.es.min.js +1 -1
- package/dist/x/maxBy.js +1 -1
- package/dist/x/maxBy.min.js +1 -1
- package/dist/x/maxBy.mjs +1 -1
- package/dist/x/noop.es.js +1 -1
- package/dist/x/noop.es.min.js +1 -1
- package/dist/x/noop.js +1 -1
- package/dist/x/noop.min.js +1 -1
- package/dist/x/noop.mjs +1 -1
- package/dist/x/pluck.es.js +221 -44
- package/dist/x/pluck.es.min.js +2 -2
- package/dist/x/pluck.js +221 -44
- package/dist/x/pluck.min.js +2 -2
- package/dist/x/pluck.mjs +221 -44
- package/dist/x/prepend.es.js +1 -1
- package/dist/x/prepend.es.min.js +1 -1
- package/dist/x/prepend.js +1 -1
- package/dist/x/prepend.min.js +1 -1
- package/dist/x/prepend.mjs +1 -1
- package/dist/x/size.es.js +1 -1
- package/dist/x/size.es.min.js +1 -1
- package/dist/x/size.js +1 -1
- package/dist/x/size.min.js +1 -1
- package/dist/x/size.mjs +1 -1
- package/dist/x/trace.es.js +38 -1
- package/dist/x/trace.es.min.js +2 -2
- package/dist/x/trace.js +38 -1
- package/dist/x/trace.min.js +2 -2
- package/dist/x/trace.mjs +38 -1
- package/dist/x/unionWith.es.js +1 -1
- package/dist/x/unionWith.es.min.js +1 -1
- package/dist/x/unionWith.js +1 -1
- package/dist/x/unionWith.min.js +1 -1
- package/dist/x/unionWith.mjs +1 -1
- package/dist/x/uniq.es.js +1 -1
- package/dist/x/uniq.es.min.js +1 -1
- package/dist/x/uniq.js +1 -1
- package/dist/x/uniq.min.js +1 -1
- package/dist/x/uniq.mjs +1 -1
- package/dist/x/unless.es.js +1 -1
- package/dist/x/unless.es.min.js +1 -1
- package/dist/x/unless.js +1 -1
- package/dist/x/unless.min.js +1 -1
- package/dist/x/unless.mjs +1 -1
- package/dist/x/values.es.js +1 -1
- package/dist/x/values.es.min.js +1 -1
- package/dist/x/values.js +1 -1
- package/dist/x/values.min.js +1 -1
- package/dist/x/values.mjs +1 -1
- package/dist/x/when.es.js +1 -1
- package/dist/x/when.es.min.js +1 -1
- package/dist/x/when.js +1 -1
- package/dist/x/when.min.js +1 -1
- package/dist/x/when.mjs +1 -1
- package/eq.js +6 -0
- package/es.js +197 -16
- package/every.js +6 -0
- package/filter.js +9 -0
- package/flatMap.js +7 -0
- package/forEach.js +20 -1
- package/get.js +6 -0
- package/gt.js +6 -0
- package/gte.js +6 -0
- package/index.js +197 -16
- package/lt.js +6 -0
- package/lte.js +6 -0
- package/map.js +118 -45
- package/not.js +8 -0
- package/omit.js +7 -0
- package/or.js +9 -0
- package/package.json +1 -1
- package/pick.js +7 -0
- package/pipe.js +8 -0
- package/reduce.js +8 -0
- package/set.js +6 -0
- package/some.js +6 -0
- package/switchCase.js +12 -0
- package/tap.js +11 -0
- package/transform.js +38 -10
- package/tryCatch.js +14 -0
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.
|
|
2
|
+
* rubico v2.6.0
|
|
3
3
|
* https://github.com/a-synchronous/rubico
|
|
4
4
|
* (c) 2019-2024 Richard Tong
|
|
5
5
|
* rubico may be freely distributed under the MIT license.
|
|
@@ -164,6 +164,9 @@ const tap = function (...args) {
|
|
|
164
164
|
if (args.length == 0) {
|
|
165
165
|
return curryArgs2(_tap, __, func)
|
|
166
166
|
}
|
|
167
|
+
if (areAnyValuesPromises(args)) {
|
|
168
|
+
return promiseAll(args).then(curry2(_tap, __, func))
|
|
169
|
+
}
|
|
167
170
|
return _tap(args, func)
|
|
168
171
|
}
|
|
169
172
|
|
|
@@ -707,6 +710,7 @@ const objectMapSeries = function (object, f) {
|
|
|
707
710
|
thunkify4(_objectMapSeriesAsync, object, f, result, doneKeys),
|
|
708
711
|
))
|
|
709
712
|
}
|
|
713
|
+
result[key] = resultItem
|
|
710
714
|
}
|
|
711
715
|
return result
|
|
712
716
|
}
|
|
@@ -801,15 +805,14 @@ const tapSync = func => function tapping(...args) {
|
|
|
801
805
|
const promiseRace = Promise.race.bind(Promise)
|
|
802
806
|
|
|
803
807
|
const arrayMapPoolAsync = async function (
|
|
804
|
-
array,
|
|
808
|
+
array, f, concurrencyLimit, result, index, promises,
|
|
805
809
|
) {
|
|
806
810
|
const arrayLength = array.length
|
|
807
811
|
while (++index < arrayLength) {
|
|
808
812
|
if (promises.size >= concurrencyLimit) {
|
|
809
813
|
await promiseRace(promises)
|
|
810
814
|
}
|
|
811
|
-
|
|
812
|
-
const resultItem = mapper(array[index])
|
|
815
|
+
const resultItem = f(array[index])
|
|
813
816
|
if (isPromise(resultItem)) {
|
|
814
817
|
const selfDeletingPromise = resultItem.then(
|
|
815
818
|
tapSync(() => promises.delete(selfDeletingPromise)))
|
|
@@ -822,13 +825,12 @@ const arrayMapPoolAsync = async function (
|
|
|
822
825
|
return promiseAll(result)
|
|
823
826
|
}
|
|
824
827
|
|
|
825
|
-
const arrayMapPool = function (array,
|
|
828
|
+
const arrayMapPool = function (array, concurrency, f) {
|
|
826
829
|
const arrayLength = array.length,
|
|
827
830
|
result = Array(arrayLength)
|
|
828
831
|
let index = -1
|
|
829
832
|
while (++index < arrayLength) {
|
|
830
|
-
|
|
831
|
-
const resultItem = mapper(array[index])
|
|
833
|
+
const resultItem = f(array[index])
|
|
832
834
|
if (isPromise(resultItem)) {
|
|
833
835
|
const promises = new Set(),
|
|
834
836
|
selfDeletingPromise = resultItem.then(
|
|
@@ -836,13 +838,167 @@ const arrayMapPool = function (array, mapper, concurrentLimit) {
|
|
|
836
838
|
promises.add(selfDeletingPromise)
|
|
837
839
|
result[index] = selfDeletingPromise
|
|
838
840
|
return arrayMapPoolAsync(
|
|
839
|
-
array,
|
|
841
|
+
array, f, concurrency, result, index, promises)
|
|
840
842
|
}
|
|
841
843
|
result[index] = resultItem
|
|
842
844
|
}
|
|
843
845
|
return result
|
|
844
846
|
}
|
|
845
847
|
|
|
848
|
+
const stringMapPool = function (s, concurrency, f) {
|
|
849
|
+
const result = arrayMapPool(s, concurrency, f)
|
|
850
|
+
return isPromise(result)
|
|
851
|
+
? result.then(curry3(callPropUnary, __, 'join', ''))
|
|
852
|
+
: result.join('')
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
const _setMapPoolAsync = async function (
|
|
856
|
+
s, iterator, concurrency, f, result, promises,
|
|
857
|
+
) {
|
|
858
|
+
let iteration = iterator.next()
|
|
859
|
+
while (!iteration.done) {
|
|
860
|
+
if (promises.size >= concurrency) {
|
|
861
|
+
await promiseRace(promises)
|
|
862
|
+
}
|
|
863
|
+
const resultItem = f(iteration.value, iteration.value, s)
|
|
864
|
+
if (isPromise(resultItem)) {
|
|
865
|
+
const selfDeletingPromise = resultItem.then(resolvedValue => {
|
|
866
|
+
promises.delete(selfDeletingPromise)
|
|
867
|
+
result.add(resolvedValue)
|
|
868
|
+
})
|
|
869
|
+
promises.add(selfDeletingPromise)
|
|
870
|
+
} else {
|
|
871
|
+
result.add(resultItem)
|
|
872
|
+
}
|
|
873
|
+
iteration = iterator.next()
|
|
874
|
+
}
|
|
875
|
+
if (promises.size > 0) {
|
|
876
|
+
await promiseAll(promises)
|
|
877
|
+
}
|
|
878
|
+
return result
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
const setMapPool = function (s, concurrency, f) {
|
|
882
|
+
const result = new Set()
|
|
883
|
+
const iterator = s[symbolIterator]()
|
|
884
|
+
let iteration = iterator.next()
|
|
885
|
+
while (!iteration.done) {
|
|
886
|
+
const resultItem = f(iteration.value, iteration.value, s)
|
|
887
|
+
if (isPromise(resultItem)) {
|
|
888
|
+
const promises = new Set()
|
|
889
|
+
const selfDeletingPromise = resultItem.then(resolvedValue => {
|
|
890
|
+
promises.delete(selfDeletingPromise)
|
|
891
|
+
result.add(resolvedValue)
|
|
892
|
+
})
|
|
893
|
+
promises.add(selfDeletingPromise)
|
|
894
|
+
return _setMapPoolAsync(s, iterator, concurrency, f, result, promises)
|
|
895
|
+
}
|
|
896
|
+
result.add(resultItem)
|
|
897
|
+
iteration = iterator.next()
|
|
898
|
+
}
|
|
899
|
+
return result
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
const _mapMapPoolAsync = async function (
|
|
903
|
+
m, iterator, concurrency, f, result, promises,
|
|
904
|
+
) {
|
|
905
|
+
let iteration = iterator.next()
|
|
906
|
+
while (!iteration.done) {
|
|
907
|
+
if (promises.size >= concurrency) {
|
|
908
|
+
await promiseRace(promises)
|
|
909
|
+
}
|
|
910
|
+
const key = iteration.value[0]
|
|
911
|
+
const resultItem = f(iteration.value[1], key, m)
|
|
912
|
+
if (isPromise(resultItem)) {
|
|
913
|
+
result.set(key, resultItem)
|
|
914
|
+
const selfDeletingPromise = resultItem.then(resolvedValue => {
|
|
915
|
+
promises.delete(selfDeletingPromise)
|
|
916
|
+
result.set(key, resolvedValue)
|
|
917
|
+
})
|
|
918
|
+
promises.add(selfDeletingPromise)
|
|
919
|
+
} else {
|
|
920
|
+
result.set(key, resultItem)
|
|
921
|
+
}
|
|
922
|
+
iteration = iterator.next()
|
|
923
|
+
}
|
|
924
|
+
if (promises.size > 0) {
|
|
925
|
+
await promiseAll(promises)
|
|
926
|
+
}
|
|
927
|
+
return result
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
const mapMapPool = function (m, concurrency, f) {
|
|
931
|
+
const result = new Map()
|
|
932
|
+
const iterator = m[symbolIterator]()
|
|
933
|
+
let iteration = iterator.next()
|
|
934
|
+
while (!iteration.done) {
|
|
935
|
+
const key = iteration.value[0]
|
|
936
|
+
const resultItem = f(iteration.value[1], key, m)
|
|
937
|
+
if (isPromise(resultItem)) {
|
|
938
|
+
const promises = new Set()
|
|
939
|
+
result.set(key, resultItem)
|
|
940
|
+
const selfDeletingPromise = resultItem.then(resolvedValue => {
|
|
941
|
+
promises.delete(selfDeletingPromise)
|
|
942
|
+
result.set(key, resolvedValue)
|
|
943
|
+
})
|
|
944
|
+
promises.add(selfDeletingPromise)
|
|
945
|
+
return _mapMapPoolAsync(m, iterator, concurrency, f, result, promises)
|
|
946
|
+
}
|
|
947
|
+
result.set(key, resultItem)
|
|
948
|
+
iteration = iterator.next()
|
|
949
|
+
}
|
|
950
|
+
return result
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
const _objectMapPoolAsync = async function (
|
|
954
|
+
o, concurrency, f, result, doneKeys, promises,
|
|
955
|
+
) {
|
|
956
|
+
for (const key in o) {
|
|
957
|
+
if (key in doneKeys) {
|
|
958
|
+
continue
|
|
959
|
+
}
|
|
960
|
+
if (promises.size >= concurrency) {
|
|
961
|
+
await promiseRace(promises)
|
|
962
|
+
}
|
|
963
|
+
const resultItem = f(o[key], key, o)
|
|
964
|
+
if (isPromise(resultItem)) {
|
|
965
|
+
result[key] = resultItem
|
|
966
|
+
const selfDeletingPromise = resultItem.then(resolvedValue => {
|
|
967
|
+
promises.delete(selfDeletingPromise)
|
|
968
|
+
result[key] = resolvedValue
|
|
969
|
+
})
|
|
970
|
+
promises.add(selfDeletingPromise)
|
|
971
|
+
} else {
|
|
972
|
+
result[key] = resultItem
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
if (promises.size > 0) {
|
|
976
|
+
await promiseAll(promises)
|
|
977
|
+
}
|
|
978
|
+
return result
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
const objectMapPool = function (o, concurrency, f) {
|
|
982
|
+
const result = {}
|
|
983
|
+
const doneKeys = {}
|
|
984
|
+
for (const key in o) {
|
|
985
|
+
doneKeys[key] = true
|
|
986
|
+
const resultItem = f(o[key], key, o)
|
|
987
|
+
if (isPromise(resultItem)) {
|
|
988
|
+
const promises = new Set()
|
|
989
|
+
result[key] = resultItem
|
|
990
|
+
const selfDeletingPromise = resultItem.then(resolvedValue => {
|
|
991
|
+
promises.delete(selfDeletingPromise)
|
|
992
|
+
result[key] = resolvedValue
|
|
993
|
+
})
|
|
994
|
+
promises.add(selfDeletingPromise)
|
|
995
|
+
return _objectMapPoolAsync(o, concurrency, f, result, doneKeys, promises)
|
|
996
|
+
}
|
|
997
|
+
result[key] = resultItem
|
|
998
|
+
}
|
|
999
|
+
return result
|
|
1000
|
+
}
|
|
1001
|
+
|
|
846
1002
|
const _curryArity = (arity, func, args) => function curried(...curriedArgs) {
|
|
847
1003
|
const argsLength = args.length,
|
|
848
1004
|
curriedArgsLength = curriedArgs.length,
|
|
@@ -978,7 +1134,7 @@ const _map = function (value, mapper) {
|
|
|
978
1134
|
}
|
|
979
1135
|
|
|
980
1136
|
const map = function (arg0, arg1) {
|
|
981
|
-
if (
|
|
1137
|
+
if (arg1 == null) {
|
|
982
1138
|
return curry2(_map, __, arg0)
|
|
983
1139
|
}
|
|
984
1140
|
return isPromise(arg0)
|
|
@@ -1001,7 +1157,7 @@ const _mapEntries = (value, mapper) => {
|
|
|
1001
1157
|
}
|
|
1002
1158
|
|
|
1003
1159
|
map.entries = function mapEntries(arg0, arg1) {
|
|
1004
|
-
if (
|
|
1160
|
+
if (arg1 == null) {
|
|
1005
1161
|
return curry2(_mapEntries, __, arg0)
|
|
1006
1162
|
}
|
|
1007
1163
|
return isPromise(arg0)
|
|
@@ -1033,7 +1189,7 @@ const _mapSeries = function (collection, f) {
|
|
|
1033
1189
|
}
|
|
1034
1190
|
|
|
1035
1191
|
map.series = function mapSeries(arg0, arg1) {
|
|
1036
|
-
if (
|
|
1192
|
+
if (arg1 == null) {
|
|
1037
1193
|
return curry2(_mapSeries, __, arg0)
|
|
1038
1194
|
}
|
|
1039
1195
|
return isPromise(arg0)
|
|
@@ -1041,11 +1197,35 @@ map.series = function mapSeries(arg0, arg1) {
|
|
|
1041
1197
|
: _mapSeries(arg0, arg1)
|
|
1042
1198
|
}
|
|
1043
1199
|
|
|
1044
|
-
|
|
1045
|
-
if (isArray(
|
|
1046
|
-
return arrayMapPool(
|
|
1200
|
+
const _mapPool = function (collection, concurrency, f) {
|
|
1201
|
+
if (isArray(collection)) {
|
|
1202
|
+
return arrayMapPool(collection, concurrency, f)
|
|
1203
|
+
}
|
|
1204
|
+
if (collection == null) {
|
|
1205
|
+
throw new TypeError(`invalid collection ${collection}`)
|
|
1047
1206
|
}
|
|
1048
|
-
|
|
1207
|
+
if (typeof collection == 'string' || collection.constructor == String) {
|
|
1208
|
+
return stringMapPool(collection, concurrency, f)
|
|
1209
|
+
}
|
|
1210
|
+
if (collection.constructor == Set) {
|
|
1211
|
+
return setMapPool(collection, concurrency, f)
|
|
1212
|
+
}
|
|
1213
|
+
if (collection.constructor == Map) {
|
|
1214
|
+
return mapMapPool(collection, concurrency, f)
|
|
1215
|
+
}
|
|
1216
|
+
if (collection.constructor == Object) {
|
|
1217
|
+
return objectMapPool(collection, concurrency, f)
|
|
1218
|
+
}
|
|
1219
|
+
throw new TypeError(`invalid collection ${collection}`)
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
map.pool = function mapPool(arg0, arg1, arg2) {
|
|
1223
|
+
if (arg2 == null) {
|
|
1224
|
+
return curry3(_mapPool, __, arg0, arg1)
|
|
1225
|
+
}
|
|
1226
|
+
return isPromise(arg0)
|
|
1227
|
+
? arg0.then(curry3(_mapPool, __, arg1, arg2))
|
|
1228
|
+
: _mapPool(arg0, arg1, arg2)
|
|
1049
1229
|
}
|
|
1050
1230
|
|
|
1051
1231
|
const FilteringIterator = (iterator, predicate) => ({
|
|
@@ -2152,7 +2332,8 @@ const _forEach = function (collection, callback) {
|
|
|
2152
2332
|
return collection
|
|
2153
2333
|
}
|
|
2154
2334
|
if (typeof collection.forEach == 'function') {
|
|
2155
|
-
|
|
2335
|
+
collection.forEach(callback)
|
|
2336
|
+
return collection
|
|
2156
2337
|
}
|
|
2157
2338
|
if (typeof collection[symbolIterator] == 'function') {
|
|
2158
2339
|
return iteratorForEach(collection[symbolIterator](), callback)
|
package/lt.js
CHANGED
|
@@ -47,6 +47,12 @@ const lessThan = require('./_internal/lessThan')
|
|
|
47
47
|
* console.log, // true
|
|
48
48
|
* ])
|
|
49
49
|
* ```
|
|
50
|
+
*
|
|
51
|
+
* Any promises passed in argument position are resolved for their values before further execution. This only applies to the eager version of the API.
|
|
52
|
+
*
|
|
53
|
+
* ```javascript [playground]
|
|
54
|
+
* lt(Promise.resolve({ a: 1, b: 2 }), get('a'), get('b')).then(console.log) // true
|
|
55
|
+
* ```
|
|
50
56
|
*/
|
|
51
57
|
const lt = ComparisonOperator(lessThan)
|
|
52
58
|
|
package/lte.js
CHANGED
|
@@ -47,6 +47,12 @@ const lessThanOrEqual = require('./_internal/lessThanOrEqual')
|
|
|
47
47
|
* console.log, // true
|
|
48
48
|
* ])
|
|
49
49
|
* ```
|
|
50
|
+
*
|
|
51
|
+
* Any promises passed in argument position are resolved for their values before further execution. This only applies to the eager version of the API.
|
|
52
|
+
*
|
|
53
|
+
* ```javascript [playground]
|
|
54
|
+
* lte(Promise.resolve({ a: 1, b: 1 }), get('a'), get('b')).then(console.log) // true
|
|
55
|
+
* ```
|
|
50
56
|
*/
|
|
51
57
|
const lte = ComparisonOperator(lessThanOrEqual)
|
|
52
58
|
|
package/map.js
CHANGED
|
@@ -3,6 +3,7 @@ const MappingIterator = require('./_internal/MappingIterator')
|
|
|
3
3
|
const MappingAsyncIterator = require('./_internal/MappingAsyncIterator')
|
|
4
4
|
const __ = require('./_internal/placeholder')
|
|
5
5
|
const curry2 = require('./_internal/curry2')
|
|
6
|
+
const curry3 = require('./_internal/curry3')
|
|
6
7
|
const isArray = require('./_internal/isArray')
|
|
7
8
|
const isObject = require('./_internal/isObject')
|
|
8
9
|
const arrayMap = require('./_internal/arrayMap')
|
|
@@ -16,6 +17,10 @@ const objectMapSeries = require('./_internal/objectMapSeries')
|
|
|
16
17
|
const setMapSeries = require('./_internal/setMapSeries')
|
|
17
18
|
const mapMapSeries = require('./_internal/mapMapSeries')
|
|
18
19
|
const arrayMapPool = require('./_internal/arrayMapPool')
|
|
20
|
+
const stringMapPool = require('./_internal/stringMapPool')
|
|
21
|
+
const setMapPool = require('./_internal/setMapPool')
|
|
22
|
+
const mapMapPool = require('./_internal/mapMapPool')
|
|
23
|
+
const objectMapPool = require('./_internal/objectMapPool')
|
|
19
24
|
const objectMapEntries = require('./_internal/objectMapEntries')
|
|
20
25
|
const mapMapEntries = require('./_internal/mapMapEntries')
|
|
21
26
|
const symbolIterator = require('./_internal/symbolIterator')
|
|
@@ -45,21 +50,6 @@ const symbolAsyncIterator = require('./_internal/symbolAsyncIterator')
|
|
|
45
50
|
* originalMap Map,
|
|
46
51
|
* mapMapper (value any, key any, originalMap Map)=>Promise|any
|
|
47
52
|
* ) -> mappedMap Promise|Map
|
|
48
|
-
*
|
|
49
|
-
* _map(
|
|
50
|
-
* generatorFunction ...args=>Generator,
|
|
51
|
-
* syncMapper (value any)=>any,
|
|
52
|
-
* ) -> mappingGeneratorFunction ...args=>Generator
|
|
53
|
-
*
|
|
54
|
-
* _map(
|
|
55
|
-
* asyncGeneratorFunction ...args=>AsyncGenerator,
|
|
56
|
-
* mapper (value any)=>Promise|any
|
|
57
|
-
* ) -> mappingAsyncGeneratorFunction ...args=>AsyncGenerator
|
|
58
|
-
*
|
|
59
|
-
* _map(
|
|
60
|
-
* originalReducer Reducer,
|
|
61
|
-
* mapper (value any)=>Promise|any,
|
|
62
|
-
* ) -> mappingReducer Reducer
|
|
63
53
|
* ```
|
|
64
54
|
*/
|
|
65
55
|
|
|
@@ -107,11 +97,11 @@ const _map = function (value, mapper) {
|
|
|
107
97
|
*
|
|
108
98
|
* type Mapper = (
|
|
109
99
|
* value any,
|
|
110
|
-
* indexOrKey number|string,
|
|
100
|
+
* indexOrKey number|string|any,
|
|
111
101
|
* collection Mappable
|
|
112
102
|
* )=>(resultItem Promise|any)
|
|
113
103
|
*
|
|
114
|
-
* map(collection Mappable, f Mapper) -> result Promise|Mappable
|
|
104
|
+
* map(collection Promise|Mappable, f Mapper) -> result Promise|Mappable
|
|
115
105
|
* map(f Mapper)(collection Mappable) -> result Promise|Mappable
|
|
116
106
|
* ```
|
|
117
107
|
*
|
|
@@ -246,12 +236,21 @@ const _map = function (value, mapper) {
|
|
|
246
236
|
* })()
|
|
247
237
|
* ```
|
|
248
238
|
*
|
|
239
|
+
* Any promises passed in argument position are resolved for their values before further execution. This only applies to the eager version of the API.
|
|
240
|
+
*
|
|
241
|
+
* ```javascript [playground]
|
|
242
|
+
* const asyncSquare = async n => n ** 2
|
|
243
|
+
*
|
|
244
|
+
* map(Promise.resolve([1, 2, 3, 4, 5]), asyncSquare).then(console.log)
|
|
245
|
+
* // [1, 4, 9, 16, 25]
|
|
246
|
+
* ```
|
|
247
|
+
*
|
|
249
248
|
* @execution concurrent
|
|
250
249
|
*
|
|
251
250
|
* @TODO streamMap
|
|
252
251
|
*/
|
|
253
252
|
const map = function (arg0, arg1) {
|
|
254
|
-
if (
|
|
253
|
+
if (arg1 == null) {
|
|
255
254
|
return curry2(_map, __, arg0)
|
|
256
255
|
}
|
|
257
256
|
return isPromise(arg0)
|
|
@@ -278,14 +277,19 @@ const _mapEntries = (value, mapper) => {
|
|
|
278
277
|
*
|
|
279
278
|
* @synopsis
|
|
280
279
|
* ```coffeescript [specscript]
|
|
281
|
-
*
|
|
282
|
-
* value Map|Object|Promise<Map|Object>,
|
|
283
|
-
* mapper ([key any, value any])=>Promise|[any, any],
|
|
284
|
-
* ) -> Promise|Map|Object
|
|
280
|
+
* type EntriesMappable = Object|Map
|
|
285
281
|
*
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
*
|
|
282
|
+
* type Mapper = (
|
|
283
|
+
* value any,
|
|
284
|
+
* key string|any,
|
|
285
|
+
* collection EntriesMappable
|
|
286
|
+
* )=>(resultItem Promise|any)
|
|
287
|
+
*
|
|
288
|
+
* map.entries(value Promise|EntriesMappable, mapper Mapper)
|
|
289
|
+
* -> Promise|EntriesMappable
|
|
290
|
+
*
|
|
291
|
+
* map.entries(mapper Mapper)(value EntriesMappable)
|
|
292
|
+
* -> Promise|EntriesMappable
|
|
289
293
|
* ```
|
|
290
294
|
*
|
|
291
295
|
* @description
|
|
@@ -302,10 +306,22 @@ const _mapEntries = (value, mapper) => {
|
|
|
302
306
|
* // Map(3) { 'A' => 1, 'B' => 4, 'C' => 9 }
|
|
303
307
|
* ```
|
|
304
308
|
*
|
|
309
|
+
* Any promises passed in argument position are resolved for their values before further execution. This only applies to the eager version of the API.
|
|
310
|
+
*
|
|
311
|
+
* ```javascript [playground]
|
|
312
|
+
* const asyncSquareEntries = async ([k, v]) => [k, v ** 2]
|
|
313
|
+
*
|
|
314
|
+
* map.entries(
|
|
315
|
+
* Promise.resolve({ a: 1, b: 2, c: 3 }),
|
|
316
|
+
* asyncSquareEntries,
|
|
317
|
+
* ).then(console.log)
|
|
318
|
+
* // { a: 1, b: 4, c: 9 }
|
|
319
|
+
* ```
|
|
320
|
+
*
|
|
305
321
|
* @since v1.7.0
|
|
306
322
|
*/
|
|
307
323
|
map.entries = function mapEntries(arg0, arg1) {
|
|
308
|
-
if (
|
|
324
|
+
if (arg1 == null) {
|
|
309
325
|
return curry2(_mapEntries, __, arg0)
|
|
310
326
|
}
|
|
311
327
|
return isPromise(arg0)
|
|
@@ -318,11 +334,11 @@ map.entries = function mapEntries(arg0, arg1) {
|
|
|
318
334
|
*
|
|
319
335
|
* @synopsis
|
|
320
336
|
* ```coffeescript [specscript]
|
|
321
|
-
* type Mappable = Array|Object|Set|Map
|
|
337
|
+
* type Mappable = Array|Object|Set|Map
|
|
322
338
|
*
|
|
323
339
|
* type Mapper = (
|
|
324
340
|
* value any,
|
|
325
|
-
* indexOrKey number|string,
|
|
341
|
+
* indexOrKey number|string|any,
|
|
326
342
|
* collection Mappable
|
|
327
343
|
* )=>(mappedItem Promise|any)
|
|
328
344
|
*
|
|
@@ -357,23 +373,20 @@ const _mapSeries = function (collection, f) {
|
|
|
357
373
|
*
|
|
358
374
|
* @synopsis
|
|
359
375
|
* ```coffeescript [specscript]
|
|
360
|
-
* type Mappable = Array|Object|Set|Map
|
|
376
|
+
* type Mappable = Array|Object|Set|Map
|
|
361
377
|
*
|
|
362
378
|
* type Mapper = (
|
|
363
379
|
* value any,
|
|
364
|
-
* indexOrKey number|string,
|
|
380
|
+
* indexOrKey number|string|any,
|
|
365
381
|
* collection Mappable
|
|
366
382
|
* )=>(mappedItem Promise|any)
|
|
367
383
|
*
|
|
368
|
-
* map.series( Mappable)
|
|
369
|
-
*
|
|
370
|
-
* map.series(
|
|
371
|
-
* mapperFunc (value any)=>Promise|any,
|
|
372
|
-
* )(array Array) -> Promise|Array
|
|
384
|
+
* map.series(collection Promise|Mappable, f Mapper) -> result Mappable
|
|
385
|
+
* map.series(f Mapper)(collection Mappable) -> result Mappable
|
|
373
386
|
* ```
|
|
374
387
|
*
|
|
375
388
|
* @description
|
|
376
|
-
*
|
|
389
|
+
* [map](/docs/map) with serial execution.
|
|
377
390
|
*
|
|
378
391
|
* ```javascript [playground]
|
|
379
392
|
* const delayedLog = number => new Promise(function (resolve) {
|
|
@@ -384,13 +397,22 @@ const _mapSeries = function (collection, f) {
|
|
|
384
397
|
* })
|
|
385
398
|
*
|
|
386
399
|
* console.log('start')
|
|
387
|
-
* map.series(
|
|
400
|
+
* map.series([1, 2, 3, 4, 5], delayedLog)
|
|
401
|
+
* ```
|
|
402
|
+
*
|
|
403
|
+
* Any promises passed in argument position are resolved for their values before further execution. This only applies to the eager version of the API.
|
|
404
|
+
*
|
|
405
|
+
* ```javascript [playground]
|
|
406
|
+
* const asyncSquare = async n => n ** 2
|
|
407
|
+
*
|
|
408
|
+
* map.series(Promise.resolve([1, 2, 3, 4, 5]), asyncSquare).then(console.log)
|
|
409
|
+
* // [1, 4, 9, 16, 25]
|
|
388
410
|
* ```
|
|
389
411
|
*
|
|
390
412
|
* @execution series
|
|
391
413
|
*/
|
|
392
414
|
map.series = function mapSeries(arg0, arg1) {
|
|
393
|
-
if (
|
|
415
|
+
if (arg1 == null) {
|
|
394
416
|
return curry2(_mapSeries, __, arg0)
|
|
395
417
|
}
|
|
396
418
|
return isPromise(arg0)
|
|
@@ -398,19 +420,59 @@ map.series = function mapSeries(arg0, arg1) {
|
|
|
398
420
|
: _mapSeries(arg0, arg1)
|
|
399
421
|
}
|
|
400
422
|
|
|
423
|
+
/**
|
|
424
|
+
* @name _mapPool
|
|
425
|
+
*
|
|
426
|
+
* @synopsis
|
|
427
|
+
* ```coffeescript [specscript]
|
|
428
|
+
* type Mappable = Array|Object|Set|Map
|
|
429
|
+
*
|
|
430
|
+
* _mapPool(collection Mappable, concurrency number, f function) -> result Promise|Mappable
|
|
431
|
+
* ```
|
|
432
|
+
*/
|
|
433
|
+
const _mapPool = function (collection, concurrency, f) {
|
|
434
|
+
if (isArray(collection)) {
|
|
435
|
+
return arrayMapPool(collection, concurrency, f)
|
|
436
|
+
}
|
|
437
|
+
if (collection == null) {
|
|
438
|
+
throw new TypeError(`invalid collection ${collection}`)
|
|
439
|
+
}
|
|
440
|
+
if (typeof collection == 'string' || collection.constructor == String) {
|
|
441
|
+
return stringMapPool(collection, concurrency, f)
|
|
442
|
+
}
|
|
443
|
+
if (collection.constructor == Set) {
|
|
444
|
+
return setMapPool(collection, concurrency, f)
|
|
445
|
+
}
|
|
446
|
+
if (collection.constructor == Map) {
|
|
447
|
+
return mapMapPool(collection, concurrency, f)
|
|
448
|
+
}
|
|
449
|
+
if (collection.constructor == Object) {
|
|
450
|
+
return objectMapPool(collection, concurrency, f)
|
|
451
|
+
}
|
|
452
|
+
throw new TypeError(`invalid collection ${collection}`)
|
|
453
|
+
}
|
|
454
|
+
|
|
401
455
|
/**
|
|
402
456
|
* @name map.pool
|
|
403
457
|
*
|
|
404
458
|
* @synopsis
|
|
405
459
|
* ```coffeescript [specscript]
|
|
460
|
+
* type Mappable = Array|Object|Set|Map
|
|
461
|
+
*
|
|
462
|
+
* map.pool(
|
|
463
|
+
* concurrency number,
|
|
464
|
+
* mapper (value any)=>Promise|any,
|
|
465
|
+
* )(collection Mappable) -> result Promise|Array
|
|
466
|
+
*
|
|
406
467
|
* map.pool(
|
|
407
|
-
*
|
|
468
|
+
* collection Mappable,
|
|
469
|
+
* concurrency number,
|
|
408
470
|
* mapper (value any)=>Promise|any,
|
|
409
|
-
* )
|
|
471
|
+
* ) -> result Promise|Array
|
|
410
472
|
* ```
|
|
411
473
|
*
|
|
412
474
|
* @description
|
|
413
|
-
*
|
|
475
|
+
* [map](/docs/map) with limited [concurrency](https://web.mit.edu/6.005/www/fa14/classes/17-concurrency/).
|
|
414
476
|
*
|
|
415
477
|
* ```javascript [playground]
|
|
416
478
|
* const ids = [1, 2, 3, 4, 5]
|
|
@@ -428,15 +490,26 @@ map.series = function mapSeries(arg0, arg1) {
|
|
|
428
490
|
* ]))(ids)
|
|
429
491
|
* ```
|
|
430
492
|
*
|
|
493
|
+
* Any promises passed in argument position are resolved for their values before further execution. This only applies to the eager version of the API.
|
|
494
|
+
*
|
|
495
|
+
* ```javascript [playground]
|
|
496
|
+
* const asyncSquare = async n => n ** 2
|
|
497
|
+
*
|
|
498
|
+
* map.pool(Promise.resolve([1, 2, 3, 4, 5]), 5, asyncSquare).then(console.log)
|
|
499
|
+
* // [1, 4, 9, 16, 25]
|
|
500
|
+
* ```
|
|
501
|
+
*
|
|
431
502
|
* @TODO objectMapPool
|
|
432
503
|
*
|
|
433
504
|
* @execution concurrent
|
|
434
505
|
*/
|
|
435
|
-
map.pool = (
|
|
436
|
-
if (
|
|
437
|
-
return
|
|
506
|
+
map.pool = function mapPool(arg0, arg1, arg2) {
|
|
507
|
+
if (arg2 == null) {
|
|
508
|
+
return curry3(_mapPool, __, arg0, arg1)
|
|
438
509
|
}
|
|
439
|
-
|
|
510
|
+
return isPromise(arg0)
|
|
511
|
+
? arg0.then(curry3(_mapPool, __, arg1, arg2))
|
|
512
|
+
: _mapPool(arg0, arg1, arg2)
|
|
440
513
|
}
|
|
441
514
|
|
|
442
515
|
module.exports = map
|
package/not.js
CHANGED
|
@@ -45,6 +45,14 @@ const _not = function (args, predicate) {
|
|
|
45
45
|
* not(isOdd)(3),
|
|
46
46
|
* ) // false
|
|
47
47
|
* ```
|
|
48
|
+
*
|
|
49
|
+
* Any promises passed in argument position are resolved for their values before further execution. This only applies to the eager version of the API.
|
|
50
|
+
*
|
|
51
|
+
* ```javascript [playground]
|
|
52
|
+
* const isOdd = number => number % 2 == 1
|
|
53
|
+
*
|
|
54
|
+
* not(Promise.resolve(3), isOdd).then(console.log) // false
|
|
55
|
+
* ```
|
|
48
56
|
*/
|
|
49
57
|
|
|
50
58
|
const not = function (...args) {
|
package/omit.js
CHANGED
|
@@ -62,6 +62,13 @@ const _omit = function (source, paths) {
|
|
|
62
62
|
* console.log, // { c: 9 }
|
|
63
63
|
* ])
|
|
64
64
|
* ```
|
|
65
|
+
*
|
|
66
|
+
* Any promises passed in argument position are resolved for their values before further execution. This only applies to the eager version of the API.
|
|
67
|
+
*
|
|
68
|
+
* ```javascript [playground]
|
|
69
|
+
* omit(Promise.resolve({ a: 1, b: 2, c: 3 }), ['a', 'b']).then(console.log)
|
|
70
|
+
* // { c: 3 }
|
|
71
|
+
* ```
|
|
65
72
|
*/
|
|
66
73
|
const omit = function (arg0, arg1) {
|
|
67
74
|
if (arg1 == null) {
|
package/or.js
CHANGED
|
@@ -129,6 +129,15 @@ const areAnyPredicatesTruthy = function (args, predicates) {
|
|
|
129
129
|
* ) // true
|
|
130
130
|
* ```
|
|
131
131
|
*
|
|
132
|
+
* Any promises passed in argument position are resolved for their values before further execution. This only applies to the eager version of the API.
|
|
133
|
+
*
|
|
134
|
+
* ```javascript [playground]
|
|
135
|
+
* or(Promise.resolve('aaa'), [
|
|
136
|
+
* s => s.startsWith('b'),
|
|
137
|
+
* s => s.endsWith('a'),
|
|
138
|
+
* ]).then(console.log) // true
|
|
139
|
+
* ```
|
|
140
|
+
*
|
|
132
141
|
* @execution series
|
|
133
142
|
*
|
|
134
143
|
* @note ...args slows down here by an order of magnitude
|
package/package.json
CHANGED
package/pick.js
CHANGED
|
@@ -62,6 +62,13 @@ const _pick = function (source, keys) {
|
|
|
62
62
|
* console.log, // { a: 1, c: 9 }
|
|
63
63
|
* ])
|
|
64
64
|
* ```
|
|
65
|
+
*
|
|
66
|
+
* Any promises passed in argument position are resolved for their values before further execution. This only applies to the eager version of the API.
|
|
67
|
+
*
|
|
68
|
+
* ```javascript [playground]
|
|
69
|
+
* pick(Promise.resolve({ a: 1, b: 2, c: 3 }), ['a', 'b']).then(console.log)
|
|
70
|
+
* // { a: 1, b: 2 }
|
|
71
|
+
* ```
|
|
65
72
|
*/
|
|
66
73
|
const pick = function (arg0, arg1) {
|
|
67
74
|
if (arg1 == null) {
|