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/x/differenceWith.js
CHANGED
|
@@ -32,13 +32,13 @@ const differenceWithArrayAsync = async function (
|
|
|
32
32
|
) {
|
|
33
33
|
const allValuesLength = allValues.length
|
|
34
34
|
while (++index < allValuesLength) {
|
|
35
|
-
const
|
|
36
|
-
let
|
|
37
|
-
if (isPromise(
|
|
38
|
-
|
|
35
|
+
const element = allValues[index]
|
|
36
|
+
let doesElementExistByComparator = arraySome(array, curry2(comparator, element, __))
|
|
37
|
+
if (isPromise(doesElementExistByComparator)) {
|
|
38
|
+
doesElementExistByComparator = await doesElementExistByComparator
|
|
39
39
|
}
|
|
40
|
-
if (!
|
|
41
|
-
result.push(
|
|
40
|
+
if (!doesElementExistByComparator) {
|
|
41
|
+
result.push(element)
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
return result
|
|
@@ -61,14 +61,14 @@ const differenceWithArray = function (comparator, allValues, array) {
|
|
|
61
61
|
result = []
|
|
62
62
|
let index = -1
|
|
63
63
|
while (++index < allValuesLength) {
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
if (isPromise(
|
|
67
|
-
return
|
|
68
|
-
curry3(thunkConditional, __, noop, thunkify2(arrayPush, result,
|
|
64
|
+
const element = allValues[index],
|
|
65
|
+
doesElementExistByComparator = arraySome(array, curry2(comparator, element, __))
|
|
66
|
+
if (isPromise(doesElementExistByComparator)) {
|
|
67
|
+
return doesElementExistByComparator.then(funcConcatSync(
|
|
68
|
+
curry3(thunkConditional, __, noop, thunkify2(arrayPush, result, element)),
|
|
69
69
|
thunkify5(differenceWithArrayAsync, comparator, allValues, array, result, index)))
|
|
70
|
-
} else if (!
|
|
71
|
-
result.push(
|
|
70
|
+
} else if (!doesElementExistByComparator) {
|
|
71
|
+
result.push(element)
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
return result
|
package/x/find.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export = find;
|
|
|
15
15
|
* ```
|
|
16
16
|
*
|
|
17
17
|
* @description
|
|
18
|
-
* Get the first
|
|
18
|
+
* Get the first element in a foldable collection that matches a predicate.
|
|
19
19
|
*
|
|
20
20
|
* ```javascript [playground]
|
|
21
21
|
* import find from 'https://unpkg.com/rubico/dist/x/find.es.js'
|
package/x/find.js
CHANGED
|
@@ -22,7 +22,7 @@ const asyncIteratorFind = require('../_internal/asyncIteratorFind')
|
|
|
22
22
|
* ```
|
|
23
23
|
*
|
|
24
24
|
* @description
|
|
25
|
-
* Get the first
|
|
25
|
+
* Get the first element in a foldable collection that matches a predicate.
|
|
26
26
|
*
|
|
27
27
|
* ```javascript [playground]
|
|
28
28
|
* import find from 'https://unpkg.com/rubico/dist/x/find.es.js'
|
package/x/find.test.js
CHANGED
|
@@ -2,7 +2,7 @@ const assert = require('assert')
|
|
|
2
2
|
const find = require('./find')
|
|
3
3
|
|
|
4
4
|
describe('find', () => {
|
|
5
|
-
it('gets the first
|
|
5
|
+
it('gets the first element that passes test', async () => {
|
|
6
6
|
assert.strictEqual(
|
|
7
7
|
find(x => x > 2)([1, 2, 3]),
|
|
8
8
|
3,
|
|
@@ -33,7 +33,7 @@ describe('find', () => {
|
|
|
33
33
|
)
|
|
34
34
|
})
|
|
35
35
|
|
|
36
|
-
it('returns undefined for no
|
|
36
|
+
it('returns undefined for no elements passing', async () => {
|
|
37
37
|
assert.strictEqual(
|
|
38
38
|
find(x => x > 3)([1, 2, 3]),
|
|
39
39
|
undefined,
|
package/x/findIndex.test.js
CHANGED
|
@@ -2,7 +2,7 @@ const assert = require('assert')
|
|
|
2
2
|
const findIndex = require('./findIndex')
|
|
3
3
|
|
|
4
4
|
describe('findIndex', function () {
|
|
5
|
-
it('finds the index in an array of the first
|
|
5
|
+
it('finds the index in an array of the first element matching a predicate function', async function () {
|
|
6
6
|
const startsWithAAA = string => string.startsWith('AAA')
|
|
7
7
|
{
|
|
8
8
|
const foundIndex = findIndex(startsWithAAA)([
|
package/x/first.d.ts
CHANGED
package/x/first.js
CHANGED
package/x/first.test.js
CHANGED
|
@@ -2,7 +2,7 @@ const assert = require('assert')
|
|
|
2
2
|
const first = require('./first')
|
|
3
3
|
|
|
4
4
|
describe('first', () => {
|
|
5
|
-
it('gets the first
|
|
5
|
+
it('gets the first element of an array', async () => {
|
|
6
6
|
assert.strictEqual(first([1, 2, 3]), 1)
|
|
7
7
|
assert.strictEqual(first([]), undefined)
|
|
8
8
|
})
|
package/x/groupBy.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export = groupBy;
|
|
|
35
35
|
* // }
|
|
36
36
|
* ```
|
|
37
37
|
*
|
|
38
|
-
* Additionally, pass a resolver in property position to resolve a value for group membership for each
|
|
38
|
+
* Additionally, pass a resolver in property position to resolve a value for group membership for each element.
|
|
39
39
|
*
|
|
40
40
|
* ```javascript [playground]
|
|
41
41
|
* import groupBy from 'https://unpkg.com/rubico/dist/x/groupBy.es.js'
|
package/x/groupBy.js
CHANGED
|
@@ -4,33 +4,33 @@ const reduce = require('../reduce')
|
|
|
4
4
|
const __ = require('../_internal/placeholder')
|
|
5
5
|
const curry3 = require('../_internal/curry3')
|
|
6
6
|
|
|
7
|
-
// (mapOfArrays Map<any=>Array>, key any,
|
|
7
|
+
// (mapOfArrays Map<any=>Array>, key any, element any) => mapOfArrays
|
|
8
8
|
// TODO: benchmark vs mapOfArrays.has(key)
|
|
9
|
-
const group = function (mapOfArrays, key,
|
|
9
|
+
const group = function (mapOfArrays, key, element) {
|
|
10
10
|
const array = mapOfArrays.get(key)
|
|
11
11
|
if (array == null) {
|
|
12
|
-
mapOfArrays.set(key, [
|
|
12
|
+
mapOfArrays.set(key, [element])
|
|
13
13
|
} else {
|
|
14
|
-
array.push(
|
|
14
|
+
array.push(element)
|
|
15
15
|
}
|
|
16
16
|
return mapOfArrays
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
// property string => (mapOfArrays Map<any=>Array>,
|
|
19
|
+
// property string => (mapOfArrays Map<any=>Array>, element any) => mapOfArrays
|
|
20
20
|
const groupByProperty = property => function groupByPropertyReducer(
|
|
21
|
-
mapOfArrays,
|
|
21
|
+
mapOfArrays, element,
|
|
22
22
|
) {
|
|
23
|
-
return group(mapOfArrays,
|
|
23
|
+
return group(mapOfArrays, element[property], element)
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
// resolver any=>any => (mapOfArrays Map<any=>Array>,
|
|
26
|
+
// resolver any=>any => (mapOfArrays Map<any=>Array>, element any) => mapOfArrays
|
|
27
27
|
const groupByResolver = resolver => function groupByResolverReducer(
|
|
28
|
-
mapOfArrays,
|
|
28
|
+
mapOfArrays, element,
|
|
29
29
|
) {
|
|
30
|
-
const key = resolver(
|
|
30
|
+
const key = resolver(element)
|
|
31
31
|
return isPromise(key)
|
|
32
|
-
? key.then(curry3(group, mapOfArrays, __,
|
|
33
|
-
: group(mapOfArrays, key,
|
|
32
|
+
? key.then(curry3(group, mapOfArrays, __, element))
|
|
33
|
+
: group(mapOfArrays, key, element)
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
|
|
@@ -70,7 +70,7 @@ const groupByResolver = resolver => function groupByResolverReducer(
|
|
|
70
70
|
* // }
|
|
71
71
|
* ```
|
|
72
72
|
*
|
|
73
|
-
* Additionally, pass a resolver in property position to resolve a value for group membership for each
|
|
73
|
+
* Additionally, pass a resolver in property position to resolve a value for group membership for each element.
|
|
74
74
|
*
|
|
75
75
|
* ```javascript [playground]
|
|
76
76
|
* import groupBy from 'https://unpkg.com/rubico/dist/x/groupBy.es.js'
|
package/x/last.d.ts
CHANGED
package/x/last.js
CHANGED
package/x/last.test.js
CHANGED
|
@@ -2,7 +2,7 @@ const assert = require('assert')
|
|
|
2
2
|
const last = require('./last')
|
|
3
3
|
|
|
4
4
|
describe('last', () => {
|
|
5
|
-
it('gets the last
|
|
5
|
+
it('gets the last element of an array', async () => {
|
|
6
6
|
assert.strictEqual(last([1, 2, 3]), 3)
|
|
7
7
|
assert.strictEqual(last([]), undefined)
|
|
8
8
|
})
|
package/x/maxBy.d.ts
CHANGED
|
@@ -4,22 +4,22 @@ export = maxBy;
|
|
|
4
4
|
*
|
|
5
5
|
* @synopsis
|
|
6
6
|
* ```coffeescript [specscript]
|
|
7
|
-
* maxBy(array Array, path string) ->
|
|
7
|
+
* maxBy(array Array, path string) -> maxElementByPath any
|
|
8
8
|
*
|
|
9
|
-
* maxBy(path string)(array Array) ->
|
|
9
|
+
* maxBy(path string)(array Array) -> maxElementByPath any
|
|
10
10
|
* ```
|
|
11
11
|
*
|
|
12
12
|
* @description
|
|
13
|
-
* Finds the
|
|
13
|
+
* Finds the element that is the max by a property denoted by path.
|
|
14
14
|
*
|
|
15
15
|
* ```javascript [playground]
|
|
16
16
|
* import maxBy from 'https://unpkg.com/rubico/dist/x/maxBy.es.js'
|
|
17
17
|
*
|
|
18
18
|
* const array = [{ a: 1 }, { a: 2 }, { a: 3 }]
|
|
19
19
|
*
|
|
20
|
-
* const
|
|
20
|
+
* const maxElement = maxBy(array, 'a')
|
|
21
21
|
*
|
|
22
|
-
* console.log(
|
|
22
|
+
* console.log(maxElement) // { a: 3 }
|
|
23
23
|
* ```
|
|
24
24
|
*
|
|
25
25
|
* `maxBy` composes in a lazy way.
|
|
@@ -29,13 +29,13 @@ export = maxBy;
|
|
|
29
29
|
*
|
|
30
30
|
* const numbers = [1, 2, 3]
|
|
31
31
|
*
|
|
32
|
-
* const
|
|
32
|
+
* const maxElement = pipe(numbers, [
|
|
33
33
|
* map(number => number ** 2),
|
|
34
34
|
* map(number => ({ a: { b: { c: number } } })),
|
|
35
35
|
* maxBy('a.b.c')
|
|
36
36
|
* ])
|
|
37
37
|
*
|
|
38
|
-
* console.log(
|
|
38
|
+
* console.log(maxElement) // { a: { b: { c: 9 } } }
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
41
|
declare function maxBy(...args: any[]): any;
|
package/x/maxBy.js
CHANGED
|
@@ -7,21 +7,21 @@ const curry2 = require('../_internal/curry2')
|
|
|
7
7
|
*
|
|
8
8
|
* @synopsis
|
|
9
9
|
* ```coffeescript [specscript]
|
|
10
|
-
* _maxBy(array Array, path string) ->
|
|
10
|
+
* _maxBy(array Array, path string) -> maxElementByPath any
|
|
11
11
|
* ```
|
|
12
12
|
*/
|
|
13
13
|
const _maxBy = function (array, path) {
|
|
14
14
|
const length = array.length
|
|
15
15
|
const getter = get(path)
|
|
16
16
|
let index = 0
|
|
17
|
-
let
|
|
17
|
+
let maxElement = array[index]
|
|
18
18
|
while (++index < length) {
|
|
19
|
-
const
|
|
20
|
-
if (getter(
|
|
21
|
-
|
|
19
|
+
const element = array[index]
|
|
20
|
+
if (getter(element) > getter(maxElement)) {
|
|
21
|
+
maxElement = element
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
return
|
|
24
|
+
return maxElement
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -29,22 +29,22 @@ const _maxBy = function (array, path) {
|
|
|
29
29
|
*
|
|
30
30
|
* @synopsis
|
|
31
31
|
* ```coffeescript [specscript]
|
|
32
|
-
* maxBy(array Array, path string) ->
|
|
32
|
+
* maxBy(array Array, path string) -> maxElementByPath any
|
|
33
33
|
*
|
|
34
|
-
* maxBy(path string)(array Array) ->
|
|
34
|
+
* maxBy(path string)(array Array) -> maxElementByPath any
|
|
35
35
|
* ```
|
|
36
36
|
*
|
|
37
37
|
* @description
|
|
38
|
-
* Finds the
|
|
38
|
+
* Finds the element that is the max by a property denoted by path.
|
|
39
39
|
*
|
|
40
40
|
* ```javascript [playground]
|
|
41
41
|
* import maxBy from 'https://unpkg.com/rubico/dist/x/maxBy.es.js'
|
|
42
42
|
*
|
|
43
43
|
* const array = [{ a: 1 }, { a: 2 }, { a: 3 }]
|
|
44
44
|
*
|
|
45
|
-
* const
|
|
45
|
+
* const maxElement = maxBy(array, 'a')
|
|
46
46
|
*
|
|
47
|
-
* console.log(
|
|
47
|
+
* console.log(maxElement) // { a: 3 }
|
|
48
48
|
* ```
|
|
49
49
|
*
|
|
50
50
|
* `maxBy` composes in a lazy way.
|
|
@@ -54,13 +54,13 @@ const _maxBy = function (array, path) {
|
|
|
54
54
|
*
|
|
55
55
|
* const numbers = [1, 2, 3]
|
|
56
56
|
*
|
|
57
|
-
* const
|
|
57
|
+
* const maxElement = pipe(numbers, [
|
|
58
58
|
* map(number => number ** 2),
|
|
59
59
|
* map(number => ({ a: { b: { c: number } } })),
|
|
60
60
|
* maxBy('a.b.c')
|
|
61
61
|
* ])
|
|
62
62
|
*
|
|
63
|
-
* console.log(
|
|
63
|
+
* console.log(maxElement) // { a: { b: { c: 9 } } }
|
|
64
64
|
* ```
|
|
65
65
|
*/
|
|
66
66
|
const maxBy = function (...args) {
|
package/x/maxBy.test.js
CHANGED
|
@@ -4,20 +4,20 @@ const pipe = require('../pipe')
|
|
|
4
4
|
const map = require('../map')
|
|
5
5
|
|
|
6
6
|
describe('maxBy', () => {
|
|
7
|
-
it('Finds the
|
|
7
|
+
it('Finds the element that is the max by a property denoted by path', async () => {
|
|
8
8
|
const array = [{ a: 1 }, { a: 2 }, { a: 3 }]
|
|
9
|
-
const
|
|
10
|
-
assert.deepEqual(
|
|
9
|
+
const maxElement = maxBy(array, 'a')
|
|
10
|
+
assert.deepEqual(maxElement, { a: 3 })
|
|
11
11
|
})
|
|
12
12
|
|
|
13
13
|
it('composes in a lazy way', async () => {
|
|
14
14
|
const numbers = [1, 2, 3]
|
|
15
|
-
const
|
|
15
|
+
const maxElement = pipe(numbers, [
|
|
16
16
|
map(number => number ** 2),
|
|
17
17
|
map(number => ({ a: { b: { c: number } } })),
|
|
18
18
|
maxBy('a.b.c'),
|
|
19
19
|
])
|
|
20
|
-
assert.deepEqual(
|
|
20
|
+
assert.deepEqual(maxElement, { a: { b: { c: 9 } } })
|
|
21
21
|
})
|
|
22
22
|
|
|
23
23
|
it('returns undefined for empty array', async () => {
|
package/x/pluck.test.js
CHANGED
|
@@ -4,7 +4,7 @@ const pluck = require('./pluck')
|
|
|
4
4
|
const createAbc = v => ({ a: { b: { c: v } } })
|
|
5
5
|
|
|
6
6
|
describe('pluck', () => {
|
|
7
|
-
it('creates a new collection by getting a path from every
|
|
7
|
+
it('creates a new collection by getting a path from every element of an old collection', async () => {
|
|
8
8
|
const nested = [1, 2, 3].map(createAbc)
|
|
9
9
|
assert.deepEqual(
|
|
10
10
|
pluck('a.b.c')(nested),
|
package/x/prepend.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export = prepend;
|
|
|
5
5
|
* @synopsis
|
|
6
6
|
* ```coffeescript [specscript]
|
|
7
7
|
* prepend(
|
|
8
|
-
*
|
|
8
|
+
* element string|Array,
|
|
9
9
|
* )(value string|Array) -> string|array
|
|
10
10
|
* ```
|
|
11
11
|
*
|
|
@@ -35,4 +35,4 @@ export = prepend;
|
|
|
35
35
|
*
|
|
36
36
|
* @since 1.7.3
|
|
37
37
|
*/
|
|
38
|
-
declare function prepend(
|
|
38
|
+
declare function prepend(element: any): (value: any) => string | any[];
|
package/x/prepend.js
CHANGED
|
@@ -7,7 +7,7 @@ const isArray = require('../_internal/isArray')
|
|
|
7
7
|
* @synopsis
|
|
8
8
|
* ```coffeescript [specscript]
|
|
9
9
|
* prepend(
|
|
10
|
-
*
|
|
10
|
+
* element string|Array,
|
|
11
11
|
* )(value string|Array) -> string|array
|
|
12
12
|
* ```
|
|
13
13
|
*
|
|
@@ -38,20 +38,20 @@ const isArray = require('../_internal/isArray')
|
|
|
38
38
|
* @since 1.7.3
|
|
39
39
|
*/
|
|
40
40
|
|
|
41
|
-
const prepend =
|
|
41
|
+
const prepend = element => function prependFunc(value) {
|
|
42
42
|
|
|
43
43
|
if (isArray(value)) {
|
|
44
|
-
if (isArray(
|
|
45
|
-
return [...
|
|
44
|
+
if (isArray(element)){
|
|
45
|
+
return [...element, ...value]
|
|
46
46
|
}
|
|
47
|
-
return [
|
|
47
|
+
return [element, ...value]
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
if (isString(value)){
|
|
51
|
-
if (!isString(
|
|
52
|
-
throw new TypeError(`${
|
|
51
|
+
if (!isString(element)){
|
|
52
|
+
throw new TypeError(`${element} is not a string`)
|
|
53
53
|
}
|
|
54
|
-
return `${
|
|
54
|
+
return `${element}${value}`
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
throw new TypeError(`${value} is not an Array or string`)
|
package/x/size.d.ts
CHANGED
package/x/size.js
CHANGED
|
@@ -9,7 +9,7 @@ const objectKeysLength = require('../_internal/objectKeysLength')
|
|
|
9
9
|
* ```
|
|
10
10
|
*
|
|
11
11
|
* @description
|
|
12
|
-
* Get the count of
|
|
12
|
+
* Get the count of elements in a value.
|
|
13
13
|
*
|
|
14
14
|
* ```javascript [playground]
|
|
15
15
|
* import size from 'https://unpkg.com/rubico/dist/x/size.es.js'
|
package/x/unionWith.js
CHANGED
|
@@ -56,12 +56,12 @@ const arrayIncludesWith = function (array, value, comparator) {
|
|
|
56
56
|
const arrayUniqWithAsync = async function (array, comparator, result, index) {
|
|
57
57
|
const length = array.length
|
|
58
58
|
while (++index < length) {
|
|
59
|
-
const
|
|
60
|
-
|
|
59
|
+
const element = array[index],
|
|
60
|
+
elementAlreadyExists = arrayIncludesWith(result, element, comparator)
|
|
61
61
|
if (!(
|
|
62
|
-
isPromise(
|
|
62
|
+
isPromise(elementAlreadyExists) ? await elementAlreadyExists : elementAlreadyExists
|
|
63
63
|
)) {
|
|
64
|
-
result.push(
|
|
64
|
+
result.push(element)
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
return result
|
|
@@ -86,14 +86,14 @@ const arrayUniqWith = function (array, comparator) {
|
|
|
86
86
|
result = []
|
|
87
87
|
let index = -1
|
|
88
88
|
while (++index < length) {
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
if (isPromise(
|
|
92
|
-
return
|
|
93
|
-
curry3(thunkConditional, __, noop, thunkify2(arrayPush, result,
|
|
89
|
+
const element = array[index],
|
|
90
|
+
elementAlreadyExists = arrayIncludesWith(result, element, comparator)
|
|
91
|
+
if (isPromise(elementAlreadyExists)) {
|
|
92
|
+
return elementAlreadyExists.then(funcConcatSync(
|
|
93
|
+
curry3(thunkConditional, __, noop, thunkify2(arrayPush, result, element)),
|
|
94
94
|
thunkify4(arrayUniqWithAsync, array, comparator, result, index)))
|
|
95
|
-
} else if (!
|
|
96
|
-
result.push(
|
|
95
|
+
} else if (!elementAlreadyExists) {
|
|
96
|
+
result.push(element)
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
return result
|
package/x/unionWith.test.js
CHANGED
|
@@ -101,7 +101,7 @@ describe('unionWith', () => {
|
|
|
101
101
|
const result = await p
|
|
102
102
|
assert.deepEqual(result, new Set([1, 2, 3]))
|
|
103
103
|
})
|
|
104
|
-
it('predicate
|
|
104
|
+
it('predicate element => element.name; values Set<[{...}, {...}, {...}]>; result Promise|<Set<[{...}, {...}]>>', async () => {
|
|
105
105
|
const people = new Set([{ name: 'John' }, { name: 'John' }, { name: 'Jim' }])
|
|
106
106
|
const result = unionWith((personA, personB) => personA.name === personB.name)(people)
|
|
107
107
|
assert.deepEqual(result, new Set([{ name: 'John' }, { name: 'Jim' }]))
|
|
@@ -190,7 +190,7 @@ describe('unionWith', () => {
|
|
|
190
190
|
{
|
|
191
191
|
const subject = unionWith(() => Promise.resolve(false))(gen)
|
|
192
192
|
const arr = []
|
|
193
|
-
for await (const
|
|
193
|
+
for await (const element of subject) arr.push(element)
|
|
194
194
|
assert.deepEqual(arr, [1, 2, 3, 1, 2, 3, 5, 5, 5])
|
|
195
195
|
}
|
|
196
196
|
{
|
|
@@ -206,12 +206,12 @@ describe('unionWith', () => {
|
|
|
206
206
|
const gen = async function*() { yield numbersAsyncGeneratorFunc; yield numbersGeneratorFunc; yield* [5, 5, 5] }
|
|
207
207
|
const subject = unionWith(() => false)(gen)
|
|
208
208
|
const arr = []
|
|
209
|
-
for await (const
|
|
209
|
+
for await (const element of subject) arr.push(element)
|
|
210
210
|
assert.deepEqual(arr, [1, 2, 3, 1, 2, 3, 5, 5, 5])
|
|
211
211
|
{
|
|
212
212
|
const subject = unionWith(async () => true)(gen)
|
|
213
213
|
const arr = []
|
|
214
|
-
for await (const
|
|
214
|
+
for await (const element of subject) arr.push(element)
|
|
215
215
|
assert.deepEqual(arr, [1])
|
|
216
216
|
}
|
|
217
217
|
})
|
|
@@ -219,7 +219,7 @@ describe('unionWith', () => {
|
|
|
219
219
|
const gen = async function*() {}
|
|
220
220
|
const subject = unionWith(() => false)(gen)
|
|
221
221
|
const arr = []
|
|
222
|
-
for await (const
|
|
222
|
+
for await (const element of subject) arr.push(element)
|
|
223
223
|
assert.deepEqual(arr, [])
|
|
224
224
|
})
|
|
225
225
|
})
|
package/global.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|