ramda-adjunct 2.34.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/.nvmrc +1 -0
- package/CHANGELOG.md +973 -0
- package/LICENSE.md +25 -0
- package/README.md +297 -0
- package/SECURITY.md +43 -0
- package/dist/RA.node.js +11172 -0
- package/dist/RA.node.min.js +2 -0
- package/dist/RA.node.min.js.LICENSE.txt +22 -0
- package/dist/RA.web.js +11172 -0
- package/dist/RA.web.min.js +2 -0
- package/dist/RA.web.min.js.LICENSE.txt +22 -0
- package/dist/RA.web.standalone.js +27797 -0
- package/dist/RA.web.standalone.min.js +2 -0
- package/dist/RA.web.standalone.min.js.LICENSE.txt +22 -0
- package/es/Y.js +38 -0
- package/es/allEqual.js +25 -0
- package/es/allEqualTo.js +26 -0
- package/es/allIdentical.js +24 -0
- package/es/allIdenticalTo.js +26 -0
- package/es/allP.js +26 -0
- package/es/allSettledP.js +29 -0
- package/es/allUnique.js +23 -0
- package/es/anyP.js +28 -0
- package/es/appendFlipped.js +23 -0
- package/es/argsPass.js +38 -0
- package/es/async.js +57 -0
- package/es/cata.js +101 -0
- package/es/catchP.js +24 -0
- package/es/ceil.js +26 -0
- package/es/compact.js +21 -0
- package/es/concatAll.js +30 -0
- package/es/concatRight.js +29 -0
- package/es/contained.js +29 -0
- package/es/curryRight.js +24 -0
- package/es/curryRightN.js +32 -0
- package/es/defaultWhen.js +25 -0
- package/es/delayP.js +44 -0
- package/es/dispatch.js +75 -0
- package/es/divideNum.js +19 -0
- package/es/dropArgs.js +22 -0
- package/es/ensureArray.js +22 -0
- package/es/escapeRegExp.js +20 -0
- package/es/fantasy-land/Identity.js +309 -0
- package/es/fantasy-land/mapping.js +20 -0
- package/es/fantasy-land/traits.js +41 -0
- package/es/fantasy-land/util.js +11 -0
- package/es/filterIndexed.js +27 -0
- package/es/findOr.js +28 -0
- package/es/flattenDepth.js +50 -0
- package/es/flattenPath.js +27 -0
- package/es/flattenProp.js +28 -0
- package/es/floor.js +25 -0
- package/es/fnull.js +37 -0
- package/es/hasPath.js +38 -0
- package/es/inRange.js +29 -0
- package/es/index.js +252 -0
- package/es/internal/ap.js +20 -0
- package/es/internal/compareLength.js +5 -0
- package/es/internal/isOfTypeObject.js +7 -0
- package/es/internal/makeFlat.js +46 -0
- package/es/internal/ponyfills/Array.from.js +40 -0
- package/es/internal/ponyfills/Math.sign.js +5 -0
- package/es/internal/ponyfills/Math.trunc.js +14 -0
- package/es/internal/ponyfills/Number.MAX_SAFE_INTEGER.js +2 -0
- package/es/internal/ponyfills/Number.MIN_SAFE_INTEGER.js +2 -0
- package/es/internal/ponyfills/Number.isFinite.js +5 -0
- package/es/internal/ponyfills/Number.isInteger.js +4 -0
- package/es/internal/ponyfills/Number.isNaN.js +5 -0
- package/es/internal/ponyfills/Number.isSafeInteger.js +7 -0
- package/es/internal/ponyfills/Promise.allSettled.js +38 -0
- package/es/internal/ponyfills/Promise.any.js +77 -0
- package/es/internal/ponyfills/String.padEnd.js +24 -0
- package/es/internal/ponyfills/String.padStart.js +26 -0
- package/es/internal/ponyfills/String.repeat.js +46 -0
- package/es/internal/ponyfills/String.replaceAll.js +34 -0
- package/es/internal/ponyfills/String.trimEnd.js +3 -0
- package/es/internal/ponyfills/String.trimStart.js +3 -0
- package/es/invoke.js +20 -0
- package/es/invokeArgs.js +30 -0
- package/es/isArray.js +22 -0
- package/es/isArrayLike.js +87 -0
- package/es/isAsyncFunction.js +22 -0
- package/es/isBigInt.js +23 -0
- package/es/isBoolean.js +21 -0
- package/es/isDate.js +20 -0
- package/es/isEmptyArray.js +26 -0
- package/es/isEmptyString.js +27 -0
- package/es/isError.js +20 -0
- package/es/isEven.js +29 -0
- package/es/isFalse.js +29 -0
- package/es/isFalsy.js +26 -0
- package/es/isFinite.js +33 -0
- package/es/isFloat.js +34 -0
- package/es/isFunction.js +26 -0
- package/es/isGeneratorFunction.js +33 -0
- package/es/isIndexed.js +21 -0
- package/es/isInteger.js +35 -0
- package/es/isInteger32.js +28 -0
- package/es/isIterable.js +33 -0
- package/es/isMap.js +23 -0
- package/es/isNaN.js +41 -0
- package/es/isNaturalNumber.js +25 -0
- package/es/isNegative.js +25 -0
- package/es/isNegativeZero.js +22 -0
- package/es/isNilOrEmpty.js +25 -0
- package/es/isNonEmptyArray.js +27 -0
- package/es/isNonEmptyString.js +30 -0
- package/es/isNonNegative.js +28 -0
- package/es/isNonPositive.js +28 -0
- package/es/isNotArray.js +22 -0
- package/es/isNotArrayLike.js +24 -0
- package/es/isNotAsyncFunction.js +27 -0
- package/es/isNotBoolean.js +22 -0
- package/es/isNotDate.js +21 -0
- package/es/isNotEmpty.js +25 -0
- package/es/isNotFinite.js +29 -0
- package/es/isNotFloat.js +33 -0
- package/es/isNotFunction.js +29 -0
- package/es/isNotGeneratorFunction.js +27 -0
- package/es/isNotInteger.js +34 -0
- package/es/isNotMap.js +24 -0
- package/es/isNotNaN.js +35 -0
- package/es/isNotNil.js +22 -0
- package/es/isNotNilOrEmpty.js +26 -0
- package/es/isNotNull.js +22 -0
- package/es/isNotNumber.js +23 -0
- package/es/isNotObj.js +29 -0
- package/es/isNotObjLike.js +29 -0
- package/es/isNotPair.js +25 -0
- package/es/isNotPlainObj.js +35 -0
- package/es/isNotPrimitive.js +22 -0
- package/es/isNotRegExp.js +22 -0
- package/es/isNotSet.js +23 -0
- package/es/isNotString.js +21 -0
- package/es/isNotUndefined.js +22 -0
- package/es/isNotValidDate.js +22 -0
- package/es/isNotValidNumber.js +25 -0
- package/es/isNull.js +21 -0
- package/es/isNumber.js +23 -0
- package/es/isObj.js +31 -0
- package/es/isObjLike.js +30 -0
- package/es/isOdd.js +24 -0
- package/es/isPair.js +25 -0
- package/es/isPlainObj.js +52 -0
- package/es/isPositive.js +24 -0
- package/es/isPositiveZero.js +22 -0
- package/es/isPrimitive.js +31 -0
- package/es/isPromise.js +27 -0
- package/es/isPrototypeOf.js +34 -0
- package/es/isRegExp.js +21 -0
- package/es/isSafeInteger.js +34 -0
- package/es/isSentinelValue.js +26 -0
- package/es/isSet.js +22 -0
- package/es/isSparseArray.js +30 -0
- package/es/isString.js +20 -0
- package/es/isSymbol.js +27 -0
- package/es/isThenable.js +26 -0
- package/es/isTrue.js +25 -0
- package/es/isTruthy.js +27 -0
- package/es/isUndefined.js +22 -0
- package/es/isValidDate.js +26 -0
- package/es/isValidNumber.js +26 -0
- package/es/lastP.js +63 -0
- package/es/lengthEq.js +22 -0
- package/es/lengthGt.js +22 -0
- package/es/lengthGte.js +24 -0
- package/es/lengthLt.js +22 -0
- package/es/lengthLte.js +23 -0
- package/es/lengthNotEq.js +22 -0
- package/es/lensEq.js +27 -0
- package/es/lensIso.js +55 -0
- package/es/lensNotEq.js +26 -0
- package/es/lensNotSatisfy.js +28 -0
- package/es/lensSatisfies.js +31 -0
- package/es/lensTraverse.js +42 -0
- package/es/liftF.js +37 -0
- package/es/liftFN.js +47 -0
- package/es/list.js +19 -0
- package/es/mapIndexed.js +26 -0
- package/es/mergePath.js +30 -0
- package/es/mergePaths.js +27 -0
- package/es/mergeProp.js +30 -0
- package/es/mergeProps.js +26 -0
- package/es/mergeRight.js +26 -0
- package/es/move.js +25 -0
- package/es/nand.js +27 -0
- package/es/neither.js +39 -0
- package/es/noneP.js +28 -0
- package/es/nonePass.js +31 -0
- package/es/noop.js +19 -0
- package/es/nor.js +28 -0
- package/es/notAllPass.js +31 -0
- package/es/notAllUnique.js +23 -0
- package/es/notBoth.js +39 -0
- package/es/notEqual.js +30 -0
- package/es/omitBy.js +26 -0
- package/es/omitIndexes.js +27 -0
- package/es/overlaps.js +29 -0
- package/es/padCharsEnd.js +31 -0
- package/es/padCharsStart.js +29 -0
- package/es/padEnd.js +24 -0
- package/es/padStart.js +22 -0
- package/es/pathNotEq.js +32 -0
- package/es/pathOrLazy.js +25 -0
- package/es/paths.js +27 -0
- package/es/pickIndexes.js +30 -0
- package/es/propNotEq.js +29 -0
- package/es/rangeStep.js +36 -0
- package/es/reduceIndexed.js +30 -0
- package/es/reduceP.js +111 -0
- package/es/reduceRightP.js +117 -0
- package/es/rejectP.js +23 -0
- package/es/renameKeyWith.js +28 -0
- package/es/renameKeys.js +42 -0
- package/es/renameKeysWith.js +26 -0
- package/es/repeatStr.js +24 -0
- package/es/replaceAll.js +29 -0
- package/es/resolveP.js +29 -0
- package/es/round.js +24 -0
- package/es/seq.js +44 -0
- package/es/sign.js +27 -0
- package/es/skipTake.js +22 -0
- package/es/sliceFrom.js +22 -0
- package/es/sliceTo.js +22 -0
- package/es/sortByProps.js +52 -0
- package/es/spreadPath.js +25 -0
- package/es/spreadProp.js +25 -0
- package/es/stubArray.js +19 -0
- package/es/stubNull.js +18 -0
- package/es/stubObj.js +20 -0
- package/es/stubString.js +18 -0
- package/es/stubUndefined.js +19 -0
- package/es/subtractNum.js +19 -0
- package/es/thenCatchP.js +26 -0
- package/es/thenP.js +28 -0
- package/es/toArray.js +27 -0
- package/es/toInteger32.js +24 -0
- package/es/toUinteger32.js +26 -0
- package/es/trimCharsEnd.js +22 -0
- package/es/trimCharsStart.js +22 -0
- package/es/trimEnd.js +23 -0
- package/es/trimStart.js +22 -0
- package/es/trunc.js +27 -0
- package/es/unzipObjWith.js +26 -0
- package/es/viewOr.js +30 -0
- package/es/weave.js +36 -0
- package/es/weaveLazy.js +38 -0
- package/es/zipObjWith.js +26 -0
- package/lib/Y.js +44 -0
- package/lib/allEqual.js +35 -0
- package/lib/allEqualTo.js +32 -0
- package/lib/allIdentical.js +33 -0
- package/lib/allIdenticalTo.js +32 -0
- package/lib/allP.js +32 -0
- package/lib/allSettledP.js +41 -0
- package/lib/allUnique.js +32 -0
- package/lib/anyP.js +47 -0
- package/lib/appendFlipped.js +29 -0
- package/lib/argsPass.js +48 -0
- package/lib/async.js +67 -0
- package/lib/cata.js +110 -0
- package/lib/catchP.js +30 -0
- package/lib/ceil.js +32 -0
- package/lib/compact.js +30 -0
- package/lib/concatAll.js +40 -0
- package/lib/concatRight.js +35 -0
- package/lib/contained.js +35 -0
- package/lib/curryRight.js +33 -0
- package/lib/curryRightN.js +38 -0
- package/lib/defaultWhen.js +31 -0
- package/lib/delayP.js +54 -0
- package/lib/dispatch.js +50 -0
- package/lib/divideNum.js +25 -0
- package/lib/dropArgs.js +28 -0
- package/lib/ensureArray.js +31 -0
- package/lib/escapeRegExp.js +29 -0
- package/lib/fantasy-land/Identity.js +323 -0
- package/lib/fantasy-land/mapping.js +44 -0
- package/lib/fantasy-land/traits.js +77 -0
- package/lib/fantasy-land/util.js +21 -0
- package/lib/filterIndexed.js +33 -0
- package/lib/findOr.js +34 -0
- package/lib/flattenDepth.js +58 -0
- package/lib/flattenPath.js +33 -0
- package/lib/flattenProp.js +37 -0
- package/lib/floor.js +31 -0
- package/lib/fnull.js +47 -0
- package/lib/hasPath.js +47 -0
- package/lib/inRange.js +37 -0
- package/lib/index.js +863 -0
- package/lib/internal/ap.js +37 -0
- package/lib/internal/compareLength.js +12 -0
- package/lib/internal/isOfTypeObject.js +13 -0
- package/lib/internal/makeFlat.js +54 -0
- package/lib/internal/ponyfills/Array.from.js +52 -0
- package/lib/internal/ponyfills/Math.sign.js +11 -0
- package/lib/internal/ponyfills/Math.trunc.js +22 -0
- package/lib/internal/ponyfills/Number.MAX_SAFE_INTEGER.js +7 -0
- package/lib/internal/ponyfills/Number.MIN_SAFE_INTEGER.js +7 -0
- package/lib/internal/ponyfills/Number.isFinite.js +15 -0
- package/lib/internal/ponyfills/Number.isInteger.js +14 -0
- package/lib/internal/ponyfills/Number.isNaN.js +15 -0
- package/lib/internal/ponyfills/Number.isSafeInteger.js +18 -0
- package/lib/internal/ponyfills/Promise.allSettled.js +48 -0
- package/lib/internal/ponyfills/Promise.any.js +89 -0
- package/lib/internal/ponyfills/String.padEnd.js +34 -0
- package/lib/internal/ponyfills/String.padStart.js +36 -0
- package/lib/internal/ponyfills/String.repeat.js +55 -0
- package/lib/internal/ponyfills/String.replaceAll.js +44 -0
- package/lib/internal/ponyfills/String.trimEnd.js +10 -0
- package/lib/internal/ponyfills/String.trimStart.js +10 -0
- package/lib/invoke.js +29 -0
- package/lib/invokeArgs.js +40 -0
- package/lib/isArray.js +31 -0
- package/lib/isArrayLike.js +98 -0
- package/lib/isAsyncFunction.js +28 -0
- package/lib/isBigInt.js +29 -0
- package/lib/isBoolean.js +27 -0
- package/lib/isDate.js +26 -0
- package/lib/isEmptyArray.js +35 -0
- package/lib/isEmptyString.js +33 -0
- package/lib/isError.js +26 -0
- package/lib/isEven.js +39 -0
- package/lib/isFalse.js +35 -0
- package/lib/isFalsy.js +35 -0
- package/lib/isFinite.js +46 -0
- package/lib/isFloat.js +44 -0
- package/lib/isFunction.js +36 -0
- package/lib/isGeneratorFunction.js +40 -0
- package/lib/isIndexed.js +31 -0
- package/lib/isInteger.js +47 -0
- package/lib/isInteger32.js +37 -0
- package/lib/isIterable.js +42 -0
- package/lib/isMap.js +29 -0
- package/lib/isNaN.js +54 -0
- package/lib/isNaturalNumber.js +35 -0
- package/lib/isNegative.js +34 -0
- package/lib/isNegativeZero.js +28 -0
- package/lib/isNilOrEmpty.js +31 -0
- package/lib/isNonEmptyArray.js +37 -0
- package/lib/isNonEmptyString.js +41 -0
- package/lib/isNonNegative.js +37 -0
- package/lib/isNonPositive.js +37 -0
- package/lib/isNotArray.js +31 -0
- package/lib/isNotArrayLike.js +33 -0
- package/lib/isNotAsyncFunction.js +36 -0
- package/lib/isNotBoolean.js +31 -0
- package/lib/isNotDate.js +30 -0
- package/lib/isNotEmpty.js +31 -0
- package/lib/isNotFinite.js +38 -0
- package/lib/isNotFloat.js +42 -0
- package/lib/isNotFunction.js +38 -0
- package/lib/isNotGeneratorFunction.js +36 -0
- package/lib/isNotInteger.js +43 -0
- package/lib/isNotMap.js +33 -0
- package/lib/isNotNaN.js +44 -0
- package/lib/isNotNil.js +28 -0
- package/lib/isNotNilOrEmpty.js +35 -0
- package/lib/isNotNull.js +31 -0
- package/lib/isNotNumber.js +32 -0
- package/lib/isNotObj.js +38 -0
- package/lib/isNotObjLike.js +38 -0
- package/lib/isNotPair.js +34 -0
- package/lib/isNotPlainObj.js +44 -0
- package/lib/isNotPrimitive.js +31 -0
- package/lib/isNotRegExp.js +31 -0
- package/lib/isNotSet.js +32 -0
- package/lib/isNotString.js +30 -0
- package/lib/isNotUndefined.js +31 -0
- package/lib/isNotValidDate.js +31 -0
- package/lib/isNotValidNumber.js +34 -0
- package/lib/isNull.js +27 -0
- package/lib/isNumber.js +29 -0
- package/lib/isObj.js +42 -0
- package/lib/isObjLike.js +40 -0
- package/lib/isOdd.js +33 -0
- package/lib/isPair.js +34 -0
- package/lib/isPlainObj.js +64 -0
- package/lib/isPositive.js +33 -0
- package/lib/isPositiveZero.js +28 -0
- package/lib/isPrimitive.js +47 -0
- package/lib/isPromise.js +36 -0
- package/lib/isPrototypeOf.js +43 -0
- package/lib/isRegExp.js +27 -0
- package/lib/isSafeInteger.js +46 -0
- package/lib/isSentinelValue.js +35 -0
- package/lib/isSet.js +28 -0
- package/lib/isSparseArray.js +39 -0
- package/lib/isString.js +26 -0
- package/lib/isSymbol.js +33 -0
- package/lib/isThenable.js +35 -0
- package/lib/isTrue.js +31 -0
- package/lib/isTruthy.js +33 -0
- package/lib/isUndefined.js +31 -0
- package/lib/isValidDate.js +36 -0
- package/lib/isValidNumber.js +36 -0
- package/lib/lastP.js +76 -0
- package/lib/lengthEq.js +31 -0
- package/lib/lengthGt.js +31 -0
- package/lib/lengthGte.js +33 -0
- package/lib/lengthLt.js +31 -0
- package/lib/lengthLte.js +32 -0
- package/lib/lengthNotEq.js +31 -0
- package/lib/lensEq.js +33 -0
- package/lib/lensIso.js +62 -0
- package/lib/lensNotEq.js +35 -0
- package/lib/lensNotSatisfy.js +37 -0
- package/lib/lensSatisfies.js +40 -0
- package/lib/lensTraverse.js +51 -0
- package/lib/liftF.js +46 -0
- package/lib/liftFN.js +56 -0
- package/lib/list.js +25 -0
- package/lib/mapIndexed.js +32 -0
- package/lib/mergePath.js +39 -0
- package/lib/mergePaths.js +36 -0
- package/lib/mergeProp.js +39 -0
- package/lib/mergeProps.js +32 -0
- package/lib/mergeRight.js +32 -0
- package/lib/move.js +31 -0
- package/lib/nand.js +33 -0
- package/lib/neither.js +45 -0
- package/lib/noneP.js +39 -0
- package/lib/nonePass.js +37 -0
- package/lib/noop.js +28 -0
- package/lib/nor.js +34 -0
- package/lib/notAllPass.js +37 -0
- package/lib/notAllUnique.js +32 -0
- package/lib/notBoth.js +45 -0
- package/lib/notEqual.js +36 -0
- package/lib/omitBy.js +32 -0
- package/lib/omitIndexes.js +34 -0
- package/lib/overlaps.js +38 -0
- package/lib/padCharsEnd.js +44 -0
- package/lib/padCharsStart.js +42 -0
- package/lib/padEnd.js +32 -0
- package/lib/padStart.js +30 -0
- package/lib/pathNotEq.js +38 -0
- package/lib/pathOrLazy.js +31 -0
- package/lib/paths.js +33 -0
- package/lib/pickIndexes.js +37 -0
- package/lib/propNotEq.js +35 -0
- package/lib/rangeStep.js +45 -0
- package/lib/reduceIndexed.js +36 -0
- package/lib/reduceP.js +122 -0
- package/lib/reduceRightP.js +129 -0
- package/lib/rejectP.js +29 -0
- package/lib/renameKeyWith.js +37 -0
- package/lib/renameKeys.js +51 -0
- package/lib/renameKeysWith.js +32 -0
- package/lib/repeatStr.js +37 -0
- package/lib/replaceAll.js +42 -0
- package/lib/resolveP.js +35 -0
- package/lib/round.js +30 -0
- package/lib/seq.js +50 -0
- package/lib/sign.js +39 -0
- package/lib/skipTake.js +28 -0
- package/lib/sliceFrom.js +28 -0
- package/lib/sliceTo.js +28 -0
- package/lib/sortByProps.js +58 -0
- package/lib/spreadPath.js +31 -0
- package/lib/spreadProp.js +34 -0
- package/lib/stubArray.js +25 -0
- package/lib/stubNull.js +24 -0
- package/lib/stubObj.js +26 -0
- package/lib/stubString.js +24 -0
- package/lib/stubUndefined.js +25 -0
- package/lib/subtractNum.js +25 -0
- package/lib/thenCatchP.js +33 -0
- package/lib/thenP.js +34 -0
- package/lib/toArray.js +40 -0
- package/lib/toInteger32.js +30 -0
- package/lib/toUinteger32.js +32 -0
- package/lib/trimCharsEnd.js +31 -0
- package/lib/trimCharsStart.js +31 -0
- package/lib/trimEnd.js +36 -0
- package/lib/trimStart.js +35 -0
- package/lib/trunc.js +39 -0
- package/lib/unzipObjWith.js +35 -0
- package/lib/viewOr.js +36 -0
- package/lib/weave.js +42 -0
- package/lib/weaveLazy.js +44 -0
- package/lib/zipObjWith.js +32 -0
- package/package.json +204 -0
- package/src/Y.js +32 -0
- package/src/allEqual.js +28 -0
- package/src/allEqualTo.js +25 -0
- package/src/allIdentical.js +26 -0
- package/src/allIdenticalTo.js +25 -0
- package/src/allP.js +27 -0
- package/src/allSettledP.js +34 -0
- package/src/allUnique.js +25 -0
- package/src/anyP.js +33 -0
- package/src/appendFlipped.js +24 -0
- package/src/argsPass.js +40 -0
- package/src/async.js +60 -0
- package/src/cata.js +86 -0
- package/src/catchP.js +25 -0
- package/src/ceil.js +28 -0
- package/src/compact.js +23 -0
- package/src/concatAll.js +34 -0
- package/src/concatRight.js +30 -0
- package/src/contained.js +30 -0
- package/src/curryRight.js +26 -0
- package/src/curryRightN.js +29 -0
- package/src/defaultWhen.js +26 -0
- package/src/delayP.js +45 -0
- package/src/dispatch.js +74 -0
- package/src/divideNum.js +20 -0
- package/src/dropArgs.js +23 -0
- package/src/ensureArray.js +24 -0
- package/src/escapeRegExp.js +22 -0
- package/src/fantasy-land/Identity.js +270 -0
- package/src/fantasy-land/mapping.js +20 -0
- package/src/fantasy-land/traits.js +57 -0
- package/src/fantasy-land/util.js +23 -0
- package/src/filterIndexed.js +28 -0
- package/src/findOr.js +30 -0
- package/src/flattenDepth.js +39 -0
- package/src/flattenPath.js +26 -0
- package/src/flattenProp.js +28 -0
- package/src/floor.js +27 -0
- package/src/fnull.js +38 -0
- package/src/hasPath.js +40 -0
- package/src/inRange.js +34 -0
- package/src/index.js +241 -0
- package/src/internal/ap.js +30 -0
- package/src/internal/compareLength.js +7 -0
- package/src/internal/isOfTypeObject.js +3 -0
- package/src/internal/makeFlat.js +42 -0
- package/src/internal/ponyfills/Array.from.js +34 -0
- package/src/internal/ponyfills/Math.sign.js +3 -0
- package/src/internal/ponyfills/Math.trunc.js +14 -0
- package/src/internal/ponyfills/Number.MAX_SAFE_INTEGER.js +3 -0
- package/src/internal/ponyfills/Number.MIN_SAFE_INTEGER.js +3 -0
- package/src/internal/ponyfills/Number.isFinite.js +8 -0
- package/src/internal/ponyfills/Number.isInteger.js +10 -0
- package/src/internal/ponyfills/Number.isNaN.js +8 -0
- package/src/internal/ponyfills/Number.isSafeInteger.js +11 -0
- package/src/internal/ponyfills/Promise.allSettled.js +18 -0
- package/src/internal/ponyfills/Promise.any.js +29 -0
- package/src/internal/ponyfills/String.padEnd.js +25 -0
- package/src/internal/ponyfills/String.padStart.js +27 -0
- package/src/internal/ponyfills/String.repeat.js +49 -0
- package/src/internal/ponyfills/String.replaceAll.js +44 -0
- package/src/internal/ponyfills/String.trimEnd.js +5 -0
- package/src/internal/ponyfills/String.trimStart.js +5 -0
- package/src/invoke.js +22 -0
- package/src/invokeArgs.js +36 -0
- package/src/isArray.js +27 -0
- package/src/isArrayLike.js +79 -0
- package/src/isAsyncFunction.js +23 -0
- package/src/isBigInt.js +24 -0
- package/src/isBoolean.js +22 -0
- package/src/isDate.js +21 -0
- package/src/isEmptyArray.js +28 -0
- package/src/isEmptyString.js +28 -0
- package/src/isError.js +21 -0
- package/src/isEven.js +31 -0
- package/src/isFalse.js +31 -0
- package/src/isFalsy.js +28 -0
- package/src/isFinite.js +37 -0
- package/src/isFloat.js +36 -0
- package/src/isFunction.js +32 -0
- package/src/isGeneratorFunction.js +43 -0
- package/src/isIndexed.js +24 -0
- package/src/isInteger.js +40 -0
- package/src/isInteger32.js +28 -0
- package/src/isIterable.js +37 -0
- package/src/isMap.js +25 -0
- package/src/isNaN.js +45 -0
- package/src/isNaturalNumber.js +28 -0
- package/src/isNegative.js +27 -0
- package/src/isNegativeZero.js +23 -0
- package/src/isNilOrEmpty.js +26 -0
- package/src/isNonEmptyArray.js +29 -0
- package/src/isNonEmptyString.js +32 -0
- package/src/isNonNegative.js +30 -0
- package/src/isNonPositive.js +30 -0
- package/src/isNotArray.js +24 -0
- package/src/isNotArrayLike.js +26 -0
- package/src/isNotAsyncFunction.js +27 -0
- package/src/isNotBoolean.js +24 -0
- package/src/isNotDate.js +23 -0
- package/src/isNotEmpty.js +26 -0
- package/src/isNotFinite.js +31 -0
- package/src/isNotFloat.js +35 -0
- package/src/isNotFunction.js +29 -0
- package/src/isNotGeneratorFunction.js +27 -0
- package/src/isNotInteger.js +36 -0
- package/src/isNotMap.js +27 -0
- package/src/isNotNaN.js +37 -0
- package/src/isNotNil.js +23 -0
- package/src/isNotNilOrEmpty.js +28 -0
- package/src/isNotNull.js +24 -0
- package/src/isNotNumber.js +25 -0
- package/src/isNotObj.js +29 -0
- package/src/isNotObjLike.js +29 -0
- package/src/isNotPair.js +27 -0
- package/src/isNotPlainObj.js +35 -0
- package/src/isNotPrimitive.js +25 -0
- package/src/isNotRegExp.js +24 -0
- package/src/isNotSet.js +26 -0
- package/src/isNotString.js +23 -0
- package/src/isNotUndefined.js +24 -0
- package/src/isNotValidDate.js +24 -0
- package/src/isNotValidNumber.js +27 -0
- package/src/isNull.js +22 -0
- package/src/isNumber.js +24 -0
- package/src/isObj.js +31 -0
- package/src/isObjLike.js +30 -0
- package/src/isOdd.js +29 -0
- package/src/isPair.js +27 -0
- package/src/isPlainObj.js +65 -0
- package/src/isPositive.js +26 -0
- package/src/isPositiveZero.js +23 -0
- package/src/isPrimitive.js +45 -0
- package/src/isPromise.js +32 -0
- package/src/isPrototypeOf.js +36 -0
- package/src/isRegExp.js +22 -0
- package/src/isSafeInteger.js +40 -0
- package/src/isSentinelValue.js +26 -0
- package/src/isSet.js +24 -0
- package/src/isSparseArray.js +43 -0
- package/src/isString.js +21 -0
- package/src/isSymbol.js +29 -0
- package/src/isThenable.js +28 -0
- package/src/isTrue.js +27 -0
- package/src/isTruthy.js +28 -0
- package/src/isUndefined.js +24 -0
- package/src/isValidDate.js +29 -0
- package/src/isValidNumber.js +28 -0
- package/src/lastP.js +54 -0
- package/src/lengthEq.js +24 -0
- package/src/lengthGt.js +24 -0
- package/src/lengthGte.js +26 -0
- package/src/lengthLt.js +24 -0
- package/src/lengthLte.js +25 -0
- package/src/lengthNotEq.js +24 -0
- package/src/lensEq.js +28 -0
- package/src/lensIso.js +51 -0
- package/src/lensNotEq.js +28 -0
- package/src/lensNotSatisfy.js +30 -0
- package/src/lensSatisfies.js +33 -0
- package/src/lensTraverse.js +44 -0
- package/src/liftF.js +37 -0
- package/src/liftFN.js +45 -0
- package/src/list.js +20 -0
- package/src/mapIndexed.js +27 -0
- package/src/mergePath.js +32 -0
- package/src/mergePaths.js +29 -0
- package/src/mergeProp.js +30 -0
- package/src/mergeProps.js +27 -0
- package/src/mergeRight.js +27 -0
- package/src/move.js +26 -0
- package/src/nand.js +27 -0
- package/src/neither.js +38 -0
- package/src/noneP.js +35 -0
- package/src/nonePass.js +32 -0
- package/src/noop.js +21 -0
- package/src/nor.js +28 -0
- package/src/notAllPass.js +32 -0
- package/src/notAllUnique.js +25 -0
- package/src/notBoth.js +38 -0
- package/src/notEqual.js +31 -0
- package/src/omitBy.js +25 -0
- package/src/omitIndexes.js +27 -0
- package/src/overlaps.js +32 -0
- package/src/padCharsEnd.js +37 -0
- package/src/padCharsStart.js +35 -0
- package/src/padEnd.js +25 -0
- package/src/padStart.js +23 -0
- package/src/pathNotEq.js +31 -0
- package/src/pathOrLazy.js +30 -0
- package/src/paths.js +26 -0
- package/src/pickIndexes.js +30 -0
- package/src/propNotEq.js +30 -0
- package/src/rangeStep.js +37 -0
- package/src/reduceIndexed.js +31 -0
- package/src/reduceP.js +96 -0
- package/src/reduceRightP.js +101 -0
- package/src/rejectP.js +24 -0
- package/src/renameKeyWith.js +30 -0
- package/src/renameKeys.js +40 -0
- package/src/renameKeysWith.js +27 -0
- package/src/repeatStr.js +30 -0
- package/src/replaceAll.js +35 -0
- package/src/resolveP.js +28 -0
- package/src/round.js +26 -0
- package/src/seq.js +38 -0
- package/src/sign.js +33 -0
- package/src/skipTake.js +33 -0
- package/src/sliceFrom.js +23 -0
- package/src/sliceTo.js +23 -0
- package/src/sortByProps.js +31 -0
- package/src/spreadPath.js +26 -0
- package/src/spreadProp.js +25 -0
- package/src/stubArray.js +18 -0
- package/src/stubNull.js +19 -0
- package/src/stubObj.js +19 -0
- package/src/stubString.js +19 -0
- package/src/stubUndefined.js +19 -0
- package/src/subtractNum.js +20 -0
- package/src/thenCatchP.js +27 -0
- package/src/thenP.js +29 -0
- package/src/toArray.js +32 -0
- package/src/toInteger32.js +22 -0
- package/src/toUinteger32.js +26 -0
- package/src/trimCharsEnd.js +25 -0
- package/src/trimCharsStart.js +25 -0
- package/src/trimEnd.js +30 -0
- package/src/trimStart.js +29 -0
- package/src/trunc.js +33 -0
- package/src/unzipObjWith.js +40 -0
- package/src/viewOr.js +32 -0
- package/src/weave.js +35 -0
- package/src/weaveLazy.js +37 -0
- package/src/zipObjWith.js +27 -0
- package/tonicExample.js +4 -0
- package/types/index.d.ts +1553 -0
package/es/lengthLte.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { flip, lte } from 'ramda';
|
|
2
|
+
import compareLength from './internal/compareLength';
|
|
3
|
+
/**
|
|
4
|
+
* Returns `true` if the supplied list or string has a length less than or equal to `valueLength`.
|
|
5
|
+
*
|
|
6
|
+
* @func lengthLte
|
|
7
|
+
* @memberOf RA
|
|
8
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/2.8.0|v2.8.0}
|
|
9
|
+
* @category List
|
|
10
|
+
* @sig Number -> [*] -> Boolean
|
|
11
|
+
* @param {number} valueLength The length of the list or string
|
|
12
|
+
* @param {Array|string} value The list or string
|
|
13
|
+
* @return {boolean}
|
|
14
|
+
* @see {@link RA.lengthEq|lengthEq}, {@link RA.lengthNotEq|lengthNotEq}, {@link RA.lengthLt|lengthLt}, {@link RA.lengthGt|lengthGt}, {@link RA.lengthGte|lengthGte}, {@link http://ramdajs.com/docs/#lte|lte}, {@link http://ramdajs.com/docs/#length|length}
|
|
15
|
+
* @example
|
|
16
|
+
*
|
|
17
|
+
* RA.lengthLte(3, [1,2]); //=> true
|
|
18
|
+
* RA.lengthLte(3, [1,2,3]); //=> true
|
|
19
|
+
* RA.lengthLte(3, [1,2,3,4]); //=> false
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
var lengthLte = compareLength(flip(lte));
|
|
23
|
+
export default lengthLte;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { complement, equals } from 'ramda';
|
|
2
|
+
import compareLength from './internal/compareLength';
|
|
3
|
+
/**
|
|
4
|
+
* Returns `true` if the supplied list or string has a length not equal to `valueLength`.
|
|
5
|
+
*
|
|
6
|
+
* @func lengthNotEq
|
|
7
|
+
* @memberOf RA
|
|
8
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/2.8.0|v2.8.0}
|
|
9
|
+
* @category List
|
|
10
|
+
* @sig Number -> [*] -> Boolean
|
|
11
|
+
* @param {number} valueLength The length of the list or string
|
|
12
|
+
* @param {Array|string} value The list or string
|
|
13
|
+
* @return {boolean}
|
|
14
|
+
* @see {@link RA.lengthEq|lengthEq}, {@link RA.lengthLt|lengthLt}, {@link RA.lengthGt|lengthGt}, {@link RA.lengthLte|lengthLte}, {@link RA.lengthGte|lengthGte}, {@link http://ramdajs.com/docs/#equals|equals}, {@link http://ramdajs.com/docs/#length|length}
|
|
15
|
+
* @example
|
|
16
|
+
*
|
|
17
|
+
* RA.lengthNotEq(3, [1,2,3,4]); //=> true
|
|
18
|
+
* RA.lengthNotEq(3, [1,2,3]); //=> false
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
var lengthNotEq = compareLength(complement(equals));
|
|
22
|
+
export default lengthNotEq;
|
package/es/lensEq.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { view, curryN, equals, pipe } from 'ramda';
|
|
2
|
+
/**
|
|
3
|
+
* Returns `true` if data structure focused by the given lens equals provided value.
|
|
4
|
+
*
|
|
5
|
+
* @func lensEq
|
|
6
|
+
* @memberOf RA
|
|
7
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/1.13.0|1.13.0}
|
|
8
|
+
* @category Relation
|
|
9
|
+
* @typedef Lens s a = Functor f => (a -> f a) -> s -> f s
|
|
10
|
+
* @sig Lens s a -> b -> s -> Boolean
|
|
11
|
+
* @see {@link RA.lensNotEq|lensNotEq}
|
|
12
|
+
* @param {function} lens Van Laarhoven lens
|
|
13
|
+
* @param {*} value The value to compare the focused data structure with
|
|
14
|
+
* @param {*} data The data structure
|
|
15
|
+
* @return {boolean} `true` if the focused data structure equals value, `false` otherwise
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
*
|
|
19
|
+
* RA.lensEq(R.lensIndex(0), 1, [0, 1, 2]); // => false
|
|
20
|
+
* RA.lensEq(R.lensIndex(1), 1, [0, 1, 2]); // => true
|
|
21
|
+
* RA.lensEq(R.lensPath(['a', 'b']), 'foo', { a: { b: 'foo' } }) // => true
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
var lensEq = curryN(3, function (lens, val, data) {
|
|
25
|
+
return pipe(view(lens), equals(val))(data);
|
|
26
|
+
});
|
|
27
|
+
export default lensEq;
|
package/es/lensIso.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { curry, map } from 'ramda'; // This implementation was highly inspired by the implementations
|
|
2
|
+
// in ramda-lens library.
|
|
3
|
+
//
|
|
4
|
+
// https://github.com/ramda/ramda-lens
|
|
5
|
+
// isomorphic :: ((a -> b), (b -> a)) -> Isomorphism
|
|
6
|
+
// Isomorphism = x -> y
|
|
7
|
+
|
|
8
|
+
var isomorphic = function isomorphic(to, from) {
|
|
9
|
+
var isomorphism = function isomorphism(x) {
|
|
10
|
+
return to(x);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
isomorphism.from = from;
|
|
14
|
+
return isomorphism;
|
|
15
|
+
}; // isomorphisms :: ((a -> b), (b -> a)) -> (a -> b)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var isomorphisms = function isomorphisms(to, from) {
|
|
19
|
+
return isomorphic(curry(function (toFunctorFn, target) {
|
|
20
|
+
return map(from, toFunctorFn(to(target)));
|
|
21
|
+
}), curry(function (toFunctorFn, target) {
|
|
22
|
+
return map(to, toFunctorFn(from(target)));
|
|
23
|
+
}));
|
|
24
|
+
}; // from :: Isomorphism -> a -> b
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
var from = curry(function (isomorphism, x) {
|
|
28
|
+
return isomorphism.from(x);
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* Defines an isomorphism that will work like a lens. It takes two functions.
|
|
32
|
+
* The function that converts and the function that recovers.
|
|
33
|
+
*
|
|
34
|
+
* @func lensIso
|
|
35
|
+
* @memberOf RA
|
|
36
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/1.19.0|1.19.0}
|
|
37
|
+
* @category Relation
|
|
38
|
+
* @typedef Lens s a = Functor f => (a -> f a) -> s -> f s
|
|
39
|
+
* @sig (s -> a) -> (a -> s) -> Lens s a
|
|
40
|
+
* @param {!function} to The function that converts
|
|
41
|
+
* @param {!function} from The function that recovers
|
|
42
|
+
* @return {!function} The isomorphic lens
|
|
43
|
+
* @see {@link http://ramdajs.com/docs/#lens|R.lens}
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
*
|
|
47
|
+
* const lensJSON = RA.lensIso(JSON.parse, JSON.stringify);
|
|
48
|
+
*
|
|
49
|
+
* R.over(lensJSON, assoc('b', 2), '{"a":1}'); //=> '{"a":1,"b":2}'
|
|
50
|
+
* R.over(RA.lensIso.from(lensJSON), R.replace('}', ',"b":2}'), { a: 1 }); // => { a: 1, b: 2 }
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
var lensIso = curry(isomorphisms);
|
|
54
|
+
lensIso.from = from;
|
|
55
|
+
export default lensIso;
|
package/es/lensNotEq.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { complement } from 'ramda';
|
|
2
|
+
import lensEq from './lensEq';
|
|
3
|
+
/**
|
|
4
|
+
* Returns `true` if data structure focused by the given lens doesn't equal provided value.
|
|
5
|
+
*
|
|
6
|
+
* @func lensNotEq
|
|
7
|
+
* @memberOf RA
|
|
8
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/1.13.0|1.13.0}
|
|
9
|
+
* @category Relation
|
|
10
|
+
* @typedef Lens s a = Functor f => (a -> f a) -> s -> f s
|
|
11
|
+
* @sig Lens s a -> b -> s -> Boolean
|
|
12
|
+
* @see {@link RA.lensEq|lensEq}
|
|
13
|
+
* @param {function} lens Van Laarhoven lens
|
|
14
|
+
* @param {*} value The value to compare the focused data structure with
|
|
15
|
+
* @param {*} data The data structure
|
|
16
|
+
* @return {boolean} `false` if the focused data structure equals value, `true` otherwise
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
*
|
|
20
|
+
* RA.lensNotEq(R.lensIndex(0), 1, [0, 1, 2]); // => true
|
|
21
|
+
* RA.lensNotEq(R.lensIndex(1), 1, [0, 1, 2]); // => false
|
|
22
|
+
* RA.lensNotEq(R.lensPath(['a', 'b']), 'foo', { a: { b: 'foo' } }) // => false
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
var lensNotEq = complement(lensEq);
|
|
26
|
+
export default lensNotEq;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { complement } from 'ramda';
|
|
2
|
+
import lensSatisfies from './lensSatisfies';
|
|
3
|
+
/**
|
|
4
|
+
* Returns `true` if data structure focused by the given lens doesn't satisfy the predicate.
|
|
5
|
+
* Note that the predicate is expected to return boolean value.
|
|
6
|
+
*
|
|
7
|
+
* @func lensNotSatisfy
|
|
8
|
+
* @memberOf RA
|
|
9
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/1.13.0|1.13.0}
|
|
10
|
+
* @category Relation
|
|
11
|
+
* @typedef Lens s a = Functor f => (a -> f a) -> s -> f s
|
|
12
|
+
* @sig Boolean b => (a -> b) -> Lens s a -> s -> b
|
|
13
|
+
* @see {@link RA.lensSatisfies|lensSatisfies}
|
|
14
|
+
* @param {Function} predicate The predicate function
|
|
15
|
+
* @param {Function} lens Van Laarhoven lens
|
|
16
|
+
* @param {*} data The data structure
|
|
17
|
+
* @return {boolean} `false` if the focused data structure satisfies the predicate, `true` otherwise
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
*
|
|
21
|
+
* RA.lensNotSatisfy(RA.isTrue, R.lensIndex(0), [false, true, 1]); // => true
|
|
22
|
+
* RA.lensNotSatisfy(RA.isTrue, R.lensIndex(1), [false, true, 1]); // => false
|
|
23
|
+
* RA.lensNotSatisfy(RA.isTrue, R.lensIndex(2), [false, true, 1]); // => true
|
|
24
|
+
* RA.lensNotSatisfy(R.identity, R.lensProp('x'), { x: 1 }); // => true
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
var lensNotSatisfy = complement(lensSatisfies);
|
|
28
|
+
export default lensNotSatisfy;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { view, curryN, pipe } from 'ramda';
|
|
2
|
+
import isTrue from './isTrue';
|
|
3
|
+
/**
|
|
4
|
+
* Returns `true` if data structure focused by the given lens satisfies the predicate.
|
|
5
|
+
* Note that the predicate is expected to return boolean value and will be evaluated
|
|
6
|
+
* as `false` unless the predicate returns `true`.
|
|
7
|
+
*
|
|
8
|
+
* @func lensSatisfies
|
|
9
|
+
* @memberOf RA
|
|
10
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/1.13.0|1.13.0}
|
|
11
|
+
* @category Relation
|
|
12
|
+
* @typedef Lens s a = Functor f => (a -> f a) -> s -> f s
|
|
13
|
+
* @sig Boolean b => (a -> b) -> Lens s a -> s -> b
|
|
14
|
+
* @see {@link RA.lensNotSatisfy|lensNotSatisfy}
|
|
15
|
+
* @param {Function} predicate The predicate function
|
|
16
|
+
* @param {Function} lens Van Laarhoven lens
|
|
17
|
+
* @param {*} data The data structure
|
|
18
|
+
* @return {boolean} `true` if the focused data structure satisfies the predicate, `false` otherwise
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
*
|
|
22
|
+
* RA.lensSatisfies(RA.isTrue, R.lensIndex(0), [false, true, 1]); // => false
|
|
23
|
+
* RA.lensSatisfies(RA.isTrue, R.lensIndex(1), [false, true, 1]); // => true
|
|
24
|
+
* RA.lensSatisfies(RA.isTrue, R.lensIndex(2), [false, true, 1]); // => false
|
|
25
|
+
* RA.lensSatisfies(R.identity, R.lensProp('x'), { x: 1 }); // => false
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
var lensSatisfies = curryN(3, function (predicate, lens, data) {
|
|
29
|
+
return pipe(view(lens), predicate, isTrue)(data);
|
|
30
|
+
});
|
|
31
|
+
export default lensSatisfies;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { traverse, curry, pipe, prop, curryN } from 'ramda';
|
|
2
|
+
import Identity from './fantasy-land/Identity';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a [Traversable](https://github.com/fantasyland/fantasy-land#traversable) lens
|
|
5
|
+
* from an [Applicative](https://github.com/fantasyland/fantasy-land#applicative)-returning function.
|
|
6
|
+
*
|
|
7
|
+
* When executed, it maps an [Applicative](https://github.com/fantasyland/fantasy-land#applicative)-returning
|
|
8
|
+
* function over a [Traversable](https://github.com/fantasyland/fantasy-land#traversable),
|
|
9
|
+
* then uses [`sequence`](https://ramdajs.com/docs/#sequence) to transform the resulting Traversable of Applicative
|
|
10
|
+
* into an Applicative of Traversable.
|
|
11
|
+
*
|
|
12
|
+
* Dispatches to the `traverse` method of the third argument, if present.
|
|
13
|
+
*
|
|
14
|
+
* @func lensTraverse
|
|
15
|
+
* @memberOf RA
|
|
16
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/2.7.0|2.7.0}
|
|
17
|
+
* @category Relation
|
|
18
|
+
* @typedef Lens s a = Functor f => (a -> f a) -> s -> f s
|
|
19
|
+
* @sig Applicative f => (a -> f a) -> Lens s a
|
|
20
|
+
* @param {!function} of The Applicative-returning function
|
|
21
|
+
* @return {!function} The Traversable lens
|
|
22
|
+
* @see {@link http://ramdajs.com/docs/#lens|R.lens}, {@link http://ramdajs.com/docs/#traverse|R.traverse}
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
*
|
|
26
|
+
* const maybeLens = RA.lensTraverse(Maybe.of);
|
|
27
|
+
* const safeDiv = n => d => d === 0 ? Maybe.Nothing() : Maybe.Just(n / d)
|
|
28
|
+
*
|
|
29
|
+
* R.over(maybeLens, safeDiv(10), [2, 4, 5]); // => Just([5, 2.5, 2])
|
|
30
|
+
* R.over(maybeLens, safeDiv(10), [2, 0, 5]); // => Nothing
|
|
31
|
+
*
|
|
32
|
+
* R.view(maybeLens, [Maybe.Just(2), Maybe.Just(3)]); // => Maybe.Just([2, 3])
|
|
33
|
+
*
|
|
34
|
+
* R.set(maybeLens, Maybe.Just(1), [Maybe.just(2), Maybe.Just(3)]); // => Maybe.Just([1, 1])
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
var lensTraverse = curryN(1, function (of) {
|
|
38
|
+
return curry(function (toFunctorFn, target) {
|
|
39
|
+
return Identity.of(traverse(of, pipe(toFunctorFn, prop('value')), target));
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
export default lensTraverse;
|
package/es/liftF.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { curryN } from 'ramda';
|
|
2
|
+
import liftFN from './liftFN';
|
|
3
|
+
/**
|
|
4
|
+
* "lifts" a function to be the specified arity, so that it may "map over" objects that satisfy
|
|
5
|
+
* the fantasy land Apply spec of algebraic structures.
|
|
6
|
+
*
|
|
7
|
+
* Lifting is specific for {@link https://github.com/scalaz/scalaz|scalaz} and {@link http://functionaljava.org/|function Java} implementations.
|
|
8
|
+
* Old version of fantasy land spec were not compatible with this approach,
|
|
9
|
+
* but as of fantasy land 1.0.0 Apply spec also adopted this approach.
|
|
10
|
+
*
|
|
11
|
+
* This function acts as interop for ramda <= 0.23.0 and {@link https://monet.github.io/monet.js/|monet.js}.
|
|
12
|
+
*
|
|
13
|
+
* More info {@link https://github.com/fantasyland/fantasy-land/issues/50|here}.
|
|
14
|
+
*
|
|
15
|
+
* @func liftF
|
|
16
|
+
* @memberOf RA
|
|
17
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/1.2.0|v1.2.0}
|
|
18
|
+
* @category Function
|
|
19
|
+
* @sig Apply a => (a... -> a) -> (a... -> a)
|
|
20
|
+
* @param {Function} fn The function to lift into higher context
|
|
21
|
+
* @return {Function} The lifted function
|
|
22
|
+
* @see {@link RA.liftFN|liftFN}
|
|
23
|
+
* @example
|
|
24
|
+
*
|
|
25
|
+
* const { Maybe } = require('monet');
|
|
26
|
+
*
|
|
27
|
+
* const add3 = (a, b, c) => a + b + c;
|
|
28
|
+
* const madd3 = RA.liftF(add3);
|
|
29
|
+
*
|
|
30
|
+
* madd3(Maybe.Some(10), Maybe.Some(15), Maybe.Some(17)); //=> Maybe.Some(42)
|
|
31
|
+
* madd3(Maybe.Some(10), Maybe.Nothing(), Maybe.Some(17)); //=> Maybe.Nothing()
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
var liftF = curryN(1, function (fn) {
|
|
35
|
+
return liftFN(fn.length, fn);
|
|
36
|
+
});
|
|
37
|
+
export default liftF;
|
package/es/liftFN.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { curry, head, slice, reduce, curryN, map } from 'ramda';
|
|
2
|
+
import ap from './internal/ap';
|
|
3
|
+
/**
|
|
4
|
+
* "lifts" a function to be the specified arity, so that it may "map over" objects that satisfy
|
|
5
|
+
* the fantasy land Apply spec of algebraic structures.
|
|
6
|
+
*
|
|
7
|
+
* Lifting is specific for {@link https://github.com/scalaz/scalaz|scalaz} and {@link http://www.functionaljava.org/|functional java} implementations.
|
|
8
|
+
* Old version of fantasy land spec were not compatible with this approach,
|
|
9
|
+
* but as of fantasy land 1.0.0 Apply spec also adopted this approach.
|
|
10
|
+
*
|
|
11
|
+
* This function acts as interop for ramda <= 0.23.0 and {@link https://monet.github.io/monet.js/|monet.js}.
|
|
12
|
+
*
|
|
13
|
+
* More info {@link https://github.com/fantasyland/fantasy-land/issues/50|here}.
|
|
14
|
+
*
|
|
15
|
+
* @func liftFN
|
|
16
|
+
* @memberOf RA
|
|
17
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/1.2.0|v1.2.0}
|
|
18
|
+
* @category Function
|
|
19
|
+
* @sig Apply a => Number -> (a... -> a) -> (a... -> a)
|
|
20
|
+
* @param {number} arity The arity of the lifter function
|
|
21
|
+
* @param {Function} fn The function to lift into higher context
|
|
22
|
+
* @return {Function} The lifted function
|
|
23
|
+
* @see {@link http://ramdajs.com/docs/#lift|R.lift}, {@link http://ramdajs.com/docs/#ap|R.ap}
|
|
24
|
+
* @example
|
|
25
|
+
*
|
|
26
|
+
* const { Maybe } = require('monet');
|
|
27
|
+
*
|
|
28
|
+
* const add3 = (a, b, c) => a + b + c;
|
|
29
|
+
* const madd3 = RA.liftFN(3, add3);
|
|
30
|
+
*
|
|
31
|
+
* madd3(Maybe.Some(10), Maybe.Some(15), Maybe.Some(17)); //=> Maybe.Some(42)
|
|
32
|
+
* madd3(Maybe.Some(10), Maybe.Nothing(), Maybe.Some(17)); //=> Maybe.Nothing()
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
var liftFN = curry(function (arity, fn) {
|
|
36
|
+
var lifted = curryN(arity, fn);
|
|
37
|
+
return curryN(arity, function () {
|
|
38
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
39
|
+
args[_key] = arguments[_key];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var accumulator = map(lifted, head(args));
|
|
43
|
+
var apps = slice(1, Infinity, args);
|
|
44
|
+
return reduce(ap, accumulator, apps);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
export default liftFN;
|
package/es/list.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { unapply, identity } from 'ramda';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a list from arguments.
|
|
4
|
+
*
|
|
5
|
+
* @func list
|
|
6
|
+
* @memberOf RA
|
|
7
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/1.1.0|v1.1.0}
|
|
8
|
+
* @category List
|
|
9
|
+
* @sig a... -> [a...]
|
|
10
|
+
* @param {...*} items The items of the feature list
|
|
11
|
+
* @return {Array} New list created from items
|
|
12
|
+
* @see {@link https://github.com/ramda/ramda/wiki/Cookbook#create-a-list-function|Ramda Cookbook}
|
|
13
|
+
* @example
|
|
14
|
+
*
|
|
15
|
+
* RA.list('a', 'b', 'c'); //=> ['a', 'b', 'c']
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
var list = unapply(identity);
|
|
19
|
+
export default list;
|
package/es/mapIndexed.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { addIndex, map } from 'ramda';
|
|
2
|
+
/**
|
|
3
|
+
* {@link http://ramdajs.com/docs/#map|R.map} function that more closely resembles Array.prototype.map.
|
|
4
|
+
* It takes two new parameters to its callback function: the current index, and the entire list.
|
|
5
|
+
*
|
|
6
|
+
* `mapIndexed` implementation is simple : `
|
|
7
|
+
* const mapIndexed = R.addIndex(R.map);
|
|
8
|
+
* `
|
|
9
|
+
* @func mapIndexed
|
|
10
|
+
* @memberOf RA
|
|
11
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/2.5.0|v2.5.0}
|
|
12
|
+
* @category List
|
|
13
|
+
* @typedef Idx = Number
|
|
14
|
+
* @sig Functor f => ((a, Idx, f a) => b) => f a -> f b
|
|
15
|
+
* @param {Function} fn The function to be called on every element of the input `list`
|
|
16
|
+
* @param {Array} list The list to be iterated over
|
|
17
|
+
* @return {Array} The new list
|
|
18
|
+
* @see {@link http://ramdajs.com/docs/#addIndex|R.addIndex}, {@link http://ramdajs.com/docs/#map|R.map}
|
|
19
|
+
* @example
|
|
20
|
+
*
|
|
21
|
+
* RA.mapIndexed((val, idx, list) => idx + '-' + val, ['f', 'o', 'o', 'b', 'a', 'r']);
|
|
22
|
+
* //=> ['0-f', '1-o', '2-o', '3-b', '4-a', '5-r']
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
var mapIndexed = addIndex(map);
|
|
26
|
+
export default mapIndexed;
|
package/es/mergePath.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { curry, over, lensPath } from 'ramda';
|
|
2
|
+
import mergeRight from './mergeRight';
|
|
3
|
+
/**
|
|
4
|
+
* Create a new object with the own properties of the object under the `path`
|
|
5
|
+
* merged with the own properties of the provided `source`.
|
|
6
|
+
* If a key exists in both objects, the value from the `source` object will be used.
|
|
7
|
+
*
|
|
8
|
+
* @func mergePath
|
|
9
|
+
* @memberOf RA
|
|
10
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/1.18.0|v1.18.0}
|
|
11
|
+
* @category Object
|
|
12
|
+
* @sig [k] -> {a} -> {k: {a}} -> {k: {a}}
|
|
13
|
+
* @see {@link RA.mergeProp|mergeProp}
|
|
14
|
+
* @param {!Array} path The property path of the destination object
|
|
15
|
+
* @param {!Object} source The source object
|
|
16
|
+
* @param {!Object} obj The object that has destination object under corresponding property path
|
|
17
|
+
* @return {!Object} The new version of object
|
|
18
|
+
* @example
|
|
19
|
+
*
|
|
20
|
+
* RA.mergePath(
|
|
21
|
+
* ['outer', 'inner'],
|
|
22
|
+
* { foo: 3, bar: 4 },
|
|
23
|
+
* { outer: { inner: { foo: 2 } } }
|
|
24
|
+
* ); //=> { outer: { inner: { foo: 3, bar: 4 } }
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
var mergePath = curry(function (path, source, obj) {
|
|
28
|
+
return over(lensPath(path), mergeRight(source), obj);
|
|
29
|
+
});
|
|
30
|
+
export default mergePath;
|
package/es/mergePaths.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { curryN, pipe, mergeAll } from 'ramda';
|
|
2
|
+
import paths from './paths';
|
|
3
|
+
/**
|
|
4
|
+
* Merge objects under corresponding paths.
|
|
5
|
+
*
|
|
6
|
+
* @func mergePaths
|
|
7
|
+
* @memberOf RA
|
|
8
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/1.17.0|v1.17.0}
|
|
9
|
+
* @category Object
|
|
10
|
+
* @sig [[k]] -> {k: {a}} -> {a}
|
|
11
|
+
* @see {@link RA.mergeProps|mergeProps}
|
|
12
|
+
* @param {!Array} paths The property paths to merge
|
|
13
|
+
* @param {!Object} obj The object to query
|
|
14
|
+
* @return {!Object} The object composed of merged property paths of obj
|
|
15
|
+
* @example
|
|
16
|
+
*
|
|
17
|
+
* const obj = {
|
|
18
|
+
* foo: { fooInner: { fooInner2: 1 } },
|
|
19
|
+
* bar: { barInner: 2 }
|
|
20
|
+
* };
|
|
21
|
+
*
|
|
22
|
+
* { ...obj.foo.fooInner, ...obj.bar }; //=> { fooInner2: 1, barInner: 2 }
|
|
23
|
+
* RA.mergePaths([['foo', 'fooInner'], ['bar']], obj); //=> { fooInner2: 1, barInner: 2 }
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
var mergePaths = curryN(2, pipe(paths, mergeAll));
|
|
27
|
+
export default mergePaths;
|
package/es/mergeProp.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { curry, of } from 'ramda';
|
|
2
|
+
import mergePath from './mergePath';
|
|
3
|
+
/**
|
|
4
|
+
* Create a new object with the own properties of the object under the `p`
|
|
5
|
+
* merged with the own properties of the provided `source`.
|
|
6
|
+
* If a key exists in both objects, the value from the `source` object will be used.
|
|
7
|
+
*
|
|
8
|
+
* @func mergeProp
|
|
9
|
+
* @memberOf RA
|
|
10
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/1.18.0|v1.18.0}
|
|
11
|
+
* @category Object
|
|
12
|
+
* @sig [k] -> {a} -> {k: {a}} -> {k: {a}}
|
|
13
|
+
* @see {@link RA.mergePath|mergePath}
|
|
14
|
+
* @param {!Array} p The property of the destination object
|
|
15
|
+
* @param {!Object} source The source object
|
|
16
|
+
* @param {!Object} obj The object that has destination object under corresponding property
|
|
17
|
+
* @return {!Object} The new version of object
|
|
18
|
+
* @example
|
|
19
|
+
*
|
|
20
|
+
* RA.mergeProp(
|
|
21
|
+
* 'outer',
|
|
22
|
+
* { foo: 3, bar: 4 },
|
|
23
|
+
* { outer: { foo: 2 } }
|
|
24
|
+
* ); //=> { outer: { foo: 3, bar: 4 } };
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
var mergeProp = curry(function (p, subj, obj) {
|
|
28
|
+
return mergePath(of(p), subj, obj);
|
|
29
|
+
});
|
|
30
|
+
export default mergeProp;
|
package/es/mergeProps.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { curryN, pipe, mergeAll, props } from 'ramda';
|
|
2
|
+
/**
|
|
3
|
+
* Functional equivalent of merging object properties with object spread operator.
|
|
4
|
+
*
|
|
5
|
+
* @func mergeProps
|
|
6
|
+
* @memberOf RA
|
|
7
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/1.17.0|v1.17.0}
|
|
8
|
+
* @category Object
|
|
9
|
+
* @sig [k] -> {k: {a}} -> {a}
|
|
10
|
+
* @see {@link RA.mergePaths|mergePaths}
|
|
11
|
+
* @param {!Array} ps The property names to merge
|
|
12
|
+
* @param {!Object} obj The object to query
|
|
13
|
+
* @return {!Object} The object composed of merged properties of obj
|
|
14
|
+
* @example
|
|
15
|
+
*
|
|
16
|
+
* const obj = {
|
|
17
|
+
* foo: { fooInner: 1 },
|
|
18
|
+
* bar: { barInner: 2 }
|
|
19
|
+
* };
|
|
20
|
+
*
|
|
21
|
+
* { ...obj.foo, ...obj.bar }; //=> { fooInner: 1, barInner: 2 }
|
|
22
|
+
* RA.mergeProps(['foo', 'bar'], obj); //=> { fooInner: 1, barInner: 2 }
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
var mergeProps = curryN(2, pipe(props, mergeAll));
|
|
26
|
+
export default mergeProps;
|
package/es/mergeRight.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { merge, flip } from 'ramda';
|
|
2
|
+
/**
|
|
3
|
+
* Create a new object with the own properties of the second object merged with
|
|
4
|
+
* the own properties of the first object. If a key exists in both objects,
|
|
5
|
+
* the value from the first object will be used. *
|
|
6
|
+
* Putting it simply: it sets properties only if they don't exist.
|
|
7
|
+
*
|
|
8
|
+
* @func mergeRight
|
|
9
|
+
* @deprecated since v2.12.0; available in ramda@0.26.0 as R.mergeLeft
|
|
10
|
+
* @aliases mergeLeft, resetToDefault
|
|
11
|
+
* @memberOf RA
|
|
12
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/1.6.0|v1.6.0}
|
|
13
|
+
* @category Object
|
|
14
|
+
* @sig {k: v} -> {k: v} -> {k: v}
|
|
15
|
+
* @param {Object} r Destination
|
|
16
|
+
* @param {Object} l Source
|
|
17
|
+
* @return {Object}
|
|
18
|
+
* @see {@link http://ramdajs.com/docs/#merge|R.merge}, {@link https://github.com/ramda/ramda/wiki/Cookbook#set-properties-only-if-they-dont-exist|Ramda Cookbook}
|
|
19
|
+
* @example
|
|
20
|
+
*
|
|
21
|
+
* RA.mergeRight({ 'age': 40 }, { 'name': 'fred', 'age': 10 });
|
|
22
|
+
* //=> { 'name': 'fred', 'age': 40 }
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
var mergeRight = flip(merge);
|
|
26
|
+
export default mergeRight;
|
package/es/move.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { compose, curry, insert, nth, remove } from 'ramda';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a new list with the item at the position `fromIdx` moved to the position `toIdx`. If the
|
|
4
|
+
* `toIdx` is out of the `list` range, the item will be placed at the last position of the `list`.
|
|
5
|
+
* When negative indices are provided, the behavior of the move is unspecified.
|
|
6
|
+
*
|
|
7
|
+
* @func move
|
|
8
|
+
* @memberOf RA
|
|
9
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/2.8.0|v2.8.0}
|
|
10
|
+
* @category List
|
|
11
|
+
* @sig Number -> Number -> [a] -> [a]
|
|
12
|
+
* @param {number} fromIdx The position of item to be moved
|
|
13
|
+
* @param {number} toIdx The position of item after move
|
|
14
|
+
* @param {Array} list The list containing the item to be moved
|
|
15
|
+
* @return {Array}
|
|
16
|
+
* @example
|
|
17
|
+
*
|
|
18
|
+
* const list = ['a', 'b', 'c', 'd', 'e'];
|
|
19
|
+
* RA.move(1, 3, list) //=> ['a', 'c', 'd', 'b', 'e']
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
var move = curry(function (fromIdx, toIdx, list) {
|
|
23
|
+
return compose(insert(toIdx, nth(fromIdx, list)), remove(fromIdx, 1))(list);
|
|
24
|
+
});
|
|
25
|
+
export default move;
|
package/es/nand.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { and, complement } from 'ramda';
|
|
2
|
+
/**
|
|
3
|
+
* Returns false if both arguments are truthy; true otherwise.
|
|
4
|
+
*
|
|
5
|
+
* @func nand
|
|
6
|
+
* @memberOf RA
|
|
7
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/2.19.0|v2.19.0}
|
|
8
|
+
* @category Logic
|
|
9
|
+
* @sig a -> b -> Boolean
|
|
10
|
+
* @param {*} a
|
|
11
|
+
* @param {*} b
|
|
12
|
+
* @return {Boolean} false if both arguments are truesy
|
|
13
|
+
* @example
|
|
14
|
+
*
|
|
15
|
+
* RA.nand(true, true); //=> false
|
|
16
|
+
* RA.nand(false, true); //=> true
|
|
17
|
+
* RA.nand(true, false); //=> true
|
|
18
|
+
* RA.nand(false, false); //=> true
|
|
19
|
+
* RA.nand(1.0, 1.0); //=> false
|
|
20
|
+
* RA.nand(1.0, 0); //=> true
|
|
21
|
+
* RA.nand(0, 1.0); //=> true
|
|
22
|
+
* RA.nand(0, 0); //=> true
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
var nand = complement(and); // eslint-disable-line ramda/complement-simplification
|
|
26
|
+
|
|
27
|
+
export default nand;
|
package/es/neither.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { curry, compose, complement, either } from 'ramda';
|
|
2
|
+
/* eslint-disable max-len */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A function which calls the two provided functions and returns the complement of `||`ing the
|
|
6
|
+
* results.
|
|
7
|
+
* It returns false if the first function is truth-y and the complement of the second function
|
|
8
|
+
* otherwise. Note that this is short-circuited, meaning that the second function will not be
|
|
9
|
+
* invoked if the first returns a truth-y value. In short it will return true if neither predicate
|
|
10
|
+
* returns true.
|
|
11
|
+
*
|
|
12
|
+
* In addition to functions, `RA.neither` also accepts any fantasy-land compatible
|
|
13
|
+
* applicative functor.
|
|
14
|
+
*
|
|
15
|
+
* @func neither
|
|
16
|
+
* @memberOf RA
|
|
17
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/2.3.0|v2.3.0}
|
|
18
|
+
* @category Logic
|
|
19
|
+
* @sig (*... -> Boolean) -> (*... -> Boolean) -> (*... -> Boolean)
|
|
20
|
+
* @param {Function} f A predicate
|
|
21
|
+
* @param {Function} g Another predicate
|
|
22
|
+
* @return {Function} Returns a function that applies its arguments to `f` and `g` and returns the complement of `||`ing their outputs together.
|
|
23
|
+
* @see {@link http://ramdajs.com/docs/#either|R.either}, {@link http://ramdajs.com/docs/#or|R.or}
|
|
24
|
+
* @example
|
|
25
|
+
*
|
|
26
|
+
* const gt10 = R.gt(R.__, 10)
|
|
27
|
+
* const even = (x) => x % 2 === 0;
|
|
28
|
+
* const f = RA.neither(gt10, even);
|
|
29
|
+
*
|
|
30
|
+
* f(12); //=> false
|
|
31
|
+
* f(8); //=> false
|
|
32
|
+
* f(11); //=> false
|
|
33
|
+
* f(9); //=> true
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/* eslint-enable max-len */
|
|
37
|
+
|
|
38
|
+
var neither = curry(compose(complement, either));
|
|
39
|
+
export default neither;
|
package/es/noneP.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { curryN, map, pipe } from 'ramda';
|
|
2
|
+
import allP from './allP';
|
|
3
|
+
import rejectP from './rejectP';
|
|
4
|
+
import resolveP from './resolveP';
|
|
5
|
+
/**
|
|
6
|
+
* Returns a Promise that is resolved with an array of reasons when all of the provided Promises reject, or rejected when any Promise is resolved.
|
|
7
|
+
* This pattern is like allP, but fulfillments and rejections are transposed - rejections become the fulfillment values and vice versa.
|
|
8
|
+
*
|
|
9
|
+
* @func noneP
|
|
10
|
+
* @memberOf RA
|
|
11
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/2.22.0|v2.22.0}
|
|
12
|
+
* @category Function
|
|
13
|
+
* @sig [Promise a] -> Promise [a]
|
|
14
|
+
* @param {Iterable.<*>} iterable An iterable object such as an Array or String
|
|
15
|
+
* @return {Promise} A Promise that is resolved with a list of rejection reasons if all Promises are rejected, or a Promise that is rejected with the fulfillment value of the first Promise that resolves.
|
|
16
|
+
* @see {@link RA.allP|allP}
|
|
17
|
+
* @example
|
|
18
|
+
*
|
|
19
|
+
* RA.noneP([Promise.reject('hello'), Promise.reject('world')]); //=> Promise(['hello', 'world'])
|
|
20
|
+
* RA.noneP([]); //=> Promise([])
|
|
21
|
+
* RA.noneP([Promise.reject(), Promise.resolve('hello world')]); //=> Promise('hello world')
|
|
22
|
+
* RA.noneP([Promise.reject(), 'hello world']); //=> Promise('hello world')
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
var noneP = curryN(1, pipe(map(resolveP), map(function (p) {
|
|
26
|
+
return p.then(rejectP, resolveP);
|
|
27
|
+
}), allP));
|
|
28
|
+
export default noneP;
|