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
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2
|
+
|
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
4
|
+
|
|
5
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
6
|
+
|
|
7
|
+
import { empty as emptyR } from 'ramda';
|
|
8
|
+
import * as fl from './mapping';
|
|
9
|
+
import { applyTrait, functorTrait, setoidTrait, semigroupTrait, chainTrait, ordTrait } from './traits';
|
|
10
|
+
/**
|
|
11
|
+
* The simplest {@link https://github.com/fantasyland/fantasy-land|fantasy-land}
|
|
12
|
+
* compatible monad which attaches no information to values.
|
|
13
|
+
*
|
|
14
|
+
* The Identity type is a very simple type that has no interesting side effects and
|
|
15
|
+
* is effectively just a container of some value. So why does it exist ?
|
|
16
|
+
* The Identity type is often used as the base monad of a monad
|
|
17
|
+
* transformer when no other behaviour is required.
|
|
18
|
+
*
|
|
19
|
+
* @memberOf RA
|
|
20
|
+
* @implements
|
|
21
|
+
* {@link https://github.com/fantasyland/fantasy-land#apply|Apply},
|
|
22
|
+
* {@link https://github.com/fantasyland/fantasy-land#applicative|Applicative},
|
|
23
|
+
* {@link https://github.com/fantasyland/fantasy-land#functor|Functor},
|
|
24
|
+
* {@link https://github.com/fantasyland/fantasy-land#setoid|Setoid},
|
|
25
|
+
* {@link https://github.com/fantasyland/fantasy-land#semigroup|Semigroup},
|
|
26
|
+
* {@link https://github.com/fantasyland/fantasy-land#chain|Chain},
|
|
27
|
+
* {@link https://github.com/fantasyland/fantasy-land#monad|Monad},
|
|
28
|
+
* {@link https://github.com/fantasyland/fantasy-land#ord|Ord},
|
|
29
|
+
* {@link https://github.com/fantasyland/fantasy-land#monoid|Monoid*},
|
|
30
|
+
* {@link https://github.com/fantasyland/fantasy-land#contravariant|Contravariant}
|
|
31
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/1.8.0|v1.8.0}
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
var Identity = /*#__PURE__*/function (_fl$of, _fl$ap, _fl$map, _fl$equals, _fl$concat, _fl$chain, _fl$lte, _fl$empty, _fl$contramap) {
|
|
35
|
+
/**
|
|
36
|
+
* Private constructor. Use {@link RA.Identity.of|Identity.of} instead.
|
|
37
|
+
*
|
|
38
|
+
* @param {*} value
|
|
39
|
+
* @return {RA.Identity}
|
|
40
|
+
*/
|
|
41
|
+
function Identity(value) {
|
|
42
|
+
_classCallCheck(this, Identity);
|
|
43
|
+
|
|
44
|
+
this.value = value;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Catamorphism for a value.
|
|
48
|
+
* @returns {*}
|
|
49
|
+
* @example
|
|
50
|
+
*
|
|
51
|
+
* const a = Identity.of(1);
|
|
52
|
+
* a.get(); //=> 1
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
_createClass(Identity, [{
|
|
57
|
+
key: "get",
|
|
58
|
+
value: function get() {
|
|
59
|
+
return this.value;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Fantasy land {@link https://github.com/fantasyland/fantasy-land#apply|Apply} specification.
|
|
63
|
+
*
|
|
64
|
+
* @sig ap :: Apply f => f a ~> f (a -> b) -> f b
|
|
65
|
+
* @param {RA.Identity} applyWithFn
|
|
66
|
+
* @return {RA.Identity}
|
|
67
|
+
* @example
|
|
68
|
+
*
|
|
69
|
+
* const a = Identity.of(1);
|
|
70
|
+
* const b = Identity.of(1).map(a => b => a + b);
|
|
71
|
+
*
|
|
72
|
+
* a.ap(b); //=> Identity(2)
|
|
73
|
+
*/
|
|
74
|
+
|
|
75
|
+
}, {
|
|
76
|
+
key: _fl$ap,
|
|
77
|
+
value: function value(applyWithFn) {
|
|
78
|
+
return applyTrait[fl.ap].call(this, applyWithFn);
|
|
79
|
+
}
|
|
80
|
+
}, {
|
|
81
|
+
key: "ap",
|
|
82
|
+
value: function ap(applyWithFn) {
|
|
83
|
+
return this[fl.ap](applyWithFn);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Fantasy land {@link https://github.com/fantasyland/fantasy-land#functor|Functor} specification.
|
|
87
|
+
*
|
|
88
|
+
* @sig map :: Functor f => f a ~> (a -> b) -> f b
|
|
89
|
+
* @param {Function} fn
|
|
90
|
+
* @return {RA.Identity}
|
|
91
|
+
* @example
|
|
92
|
+
*
|
|
93
|
+
* const a = Identity.of(1);
|
|
94
|
+
* a.map(a => a + 1); //=> Identity(2)
|
|
95
|
+
*/
|
|
96
|
+
|
|
97
|
+
}, {
|
|
98
|
+
key: _fl$map,
|
|
99
|
+
value: function value(fn) {
|
|
100
|
+
return functorTrait[fl.map].call(this, fn);
|
|
101
|
+
}
|
|
102
|
+
}, {
|
|
103
|
+
key: "map",
|
|
104
|
+
value: function map(fn) {
|
|
105
|
+
return this[fl.map](fn);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Fantasy land {@link https://github.com/fantasyland/fantasy-land#setoid|Setoid} specification.
|
|
109
|
+
*
|
|
110
|
+
* @sig equals :: Setoid a => a ~> a -> Boolean
|
|
111
|
+
* @param {RA.Identity} setoid
|
|
112
|
+
* @return {boolean}
|
|
113
|
+
* @example
|
|
114
|
+
*
|
|
115
|
+
* const a = Identity.of(1);
|
|
116
|
+
* const b = Identity.of(1);
|
|
117
|
+
* const c = Identity.of(2);
|
|
118
|
+
*
|
|
119
|
+
* a.equals(b); //=> true
|
|
120
|
+
* a.equals(c); //=> false
|
|
121
|
+
*/
|
|
122
|
+
|
|
123
|
+
}, {
|
|
124
|
+
key: _fl$equals,
|
|
125
|
+
value: function value(setoid) {
|
|
126
|
+
return setoidTrait[fl.equals].call(this, setoid);
|
|
127
|
+
}
|
|
128
|
+
}, {
|
|
129
|
+
key: "equals",
|
|
130
|
+
value: function equals(setoid) {
|
|
131
|
+
return this[fl.equals](setoid);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Fantasy land {@link https://github.com/fantasyland/fantasy-land#semigroup|Semigroup} specification.
|
|
135
|
+
*
|
|
136
|
+
* @sig concat :: Semigroup a => a ~> a -> a
|
|
137
|
+
* @param {RA.Identity} semigroup
|
|
138
|
+
* @return {RA.Identity}
|
|
139
|
+
* @example
|
|
140
|
+
*
|
|
141
|
+
* const a = Identity.of(1);
|
|
142
|
+
* const b = Identity.of(1);
|
|
143
|
+
* a.concat(b); //=> 2
|
|
144
|
+
*
|
|
145
|
+
* const c = Identity.of('c');
|
|
146
|
+
* const d = Identity.of('d');
|
|
147
|
+
* c.concat(d); //=> 'cd'
|
|
148
|
+
*
|
|
149
|
+
* const e = Identity.of(['e']);
|
|
150
|
+
* const f = Identity.of(['f']);
|
|
151
|
+
* e.concat(f); //=> ['e', 'f']
|
|
152
|
+
*/
|
|
153
|
+
|
|
154
|
+
}, {
|
|
155
|
+
key: _fl$concat,
|
|
156
|
+
value: function value(semigroup) {
|
|
157
|
+
return semigroupTrait[fl.concat].call(this, semigroup);
|
|
158
|
+
}
|
|
159
|
+
}, {
|
|
160
|
+
key: "concat",
|
|
161
|
+
value: function concat(semigroup) {
|
|
162
|
+
return this[fl.concat](semigroup);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Fantasy land {@link https://github.com/fantasyland/fantasy-land#chain|Chain} specification.
|
|
166
|
+
*
|
|
167
|
+
* @sig chain :: Chain m => m a ~> (a -> m b) -> m b
|
|
168
|
+
* @param {Function} fn Function returning the value of the same {@link https://github.com/fantasyland/fantasy-land#semigroup|Chain}
|
|
169
|
+
* @return {RA.Identity}
|
|
170
|
+
* @example
|
|
171
|
+
*
|
|
172
|
+
* const a = Identity.of(1);
|
|
173
|
+
* const fn = val => Identity.of(val + 1);
|
|
174
|
+
*
|
|
175
|
+
* a.chain(fn).chain(fn); //=> Identity(3)
|
|
176
|
+
*/
|
|
177
|
+
|
|
178
|
+
}, {
|
|
179
|
+
key: _fl$chain,
|
|
180
|
+
value: function value(fn) {
|
|
181
|
+
return chainTrait[fl.chain].call(this, fn);
|
|
182
|
+
}
|
|
183
|
+
}, {
|
|
184
|
+
key: "chain",
|
|
185
|
+
value: function chain(fn) {
|
|
186
|
+
return this[fl.chain](fn);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Fantasy land {@link https://github.com/fantasyland/fantasy-land#ord|Ord} specification.
|
|
190
|
+
*
|
|
191
|
+
* @sig lte :: Ord a => a ~> a -> Boolean
|
|
192
|
+
* @param {RA.Identity} ord
|
|
193
|
+
* @return {boolean}
|
|
194
|
+
* @example
|
|
195
|
+
*
|
|
196
|
+
* const a = Identity.of(1);
|
|
197
|
+
* const b = Identity.of(1);
|
|
198
|
+
* const c = Identity.of(2);
|
|
199
|
+
*
|
|
200
|
+
* a.lte(b); //=> true
|
|
201
|
+
* a.lte(c); //=> true
|
|
202
|
+
* c.lte(a); //=> false
|
|
203
|
+
*/
|
|
204
|
+
|
|
205
|
+
}, {
|
|
206
|
+
key: _fl$lte,
|
|
207
|
+
value: function value(ord) {
|
|
208
|
+
return ordTrait[fl.lte].call(this, ord);
|
|
209
|
+
}
|
|
210
|
+
}, {
|
|
211
|
+
key: "lte",
|
|
212
|
+
value: function lte(ord) {
|
|
213
|
+
return this[fl.lte](ord);
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Fantasy land {@link https://github.com/fantasyland/fantasy-land#monoid|Monoid*} specification.
|
|
217
|
+
* Partial implementation of Monoid specification. `empty` method on instance only, returning
|
|
218
|
+
* identity value of the wrapped type. Using `R.empty` under the hood.
|
|
219
|
+
*
|
|
220
|
+
*
|
|
221
|
+
* @sig empty :: Monoid m => () -> m
|
|
222
|
+
* @return {RA.Identity}
|
|
223
|
+
* @example
|
|
224
|
+
*
|
|
225
|
+
* const a = Identity.of('test');
|
|
226
|
+
* const i = a.empty();
|
|
227
|
+
*
|
|
228
|
+
* a.concat(i); //=> Identity('string');
|
|
229
|
+
* i.concat(a); //=> Identity('string');
|
|
230
|
+
*/
|
|
231
|
+
|
|
232
|
+
}, {
|
|
233
|
+
key: _fl$empty,
|
|
234
|
+
value: function value() {
|
|
235
|
+
return this.constructor.of(emptyR(this.value));
|
|
236
|
+
}
|
|
237
|
+
}, {
|
|
238
|
+
key: "empty",
|
|
239
|
+
value: function empty() {
|
|
240
|
+
return this[fl.empty]();
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Fantasy land {@link https://github.com/fantasyland/fantasy-land#contravariant|Contravariant} specification.
|
|
244
|
+
*
|
|
245
|
+
* @sig contramap :: Contravariant f => f a ~> (b -> a) -> f b
|
|
246
|
+
* @param {Function} fn
|
|
247
|
+
* @return {RA.Identity}
|
|
248
|
+
* @example
|
|
249
|
+
*
|
|
250
|
+
* const identity = a => a;
|
|
251
|
+
* const add1 = a => a + 1;
|
|
252
|
+
* const divide2 = a => a / 2;
|
|
253
|
+
*
|
|
254
|
+
* Identity.of(divide2).contramap(add1).get()(3); //=> 2
|
|
255
|
+
* Identity.of(identity).contramap(divide2).contramap(add1).get()(3); //=> 2
|
|
256
|
+
* Identity.of(identity).contramap(a => divide2(add1(a))).get()(3); //=> 2
|
|
257
|
+
*/
|
|
258
|
+
|
|
259
|
+
}, {
|
|
260
|
+
key: _fl$contramap,
|
|
261
|
+
value: function value(fn) {
|
|
262
|
+
var _this = this;
|
|
263
|
+
|
|
264
|
+
return this.constructor.of(function (value) {
|
|
265
|
+
return _this.value(fn(value));
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
}, {
|
|
269
|
+
key: "contramap",
|
|
270
|
+
value: function contramap(fn) {
|
|
271
|
+
return this[fl.contramap](fn);
|
|
272
|
+
}
|
|
273
|
+
}], [{
|
|
274
|
+
key: _fl$of,
|
|
275
|
+
value:
|
|
276
|
+
/**
|
|
277
|
+
* Fantasy land {@link https://github.com/fantasyland/fantasy-land#applicative|Applicative} specification.
|
|
278
|
+
*
|
|
279
|
+
* @static
|
|
280
|
+
* @sig of :: Applicative f => a -> f a
|
|
281
|
+
* @param {*} value
|
|
282
|
+
* @returns {RA.Identity}
|
|
283
|
+
* @example
|
|
284
|
+
*
|
|
285
|
+
* const a = Identity.of(1); //=> Identity(1)
|
|
286
|
+
*/
|
|
287
|
+
function value(_value) {
|
|
288
|
+
return new Identity(_value);
|
|
289
|
+
}
|
|
290
|
+
}, {
|
|
291
|
+
key: "of",
|
|
292
|
+
value: function of(value) {
|
|
293
|
+
return new Identity(value);
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* @static
|
|
297
|
+
*/
|
|
298
|
+
|
|
299
|
+
}, {
|
|
300
|
+
key: '@@type',
|
|
301
|
+
get: function get() {
|
|
302
|
+
return 'RA/Identity';
|
|
303
|
+
}
|
|
304
|
+
}]);
|
|
305
|
+
|
|
306
|
+
return Identity;
|
|
307
|
+
}(fl.of, fl.ap, fl.map, fl.equals, fl.concat, fl.chain, fl.lte, fl.empty, fl.contramap);
|
|
308
|
+
|
|
309
|
+
export default Identity;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export var equals = 'fantasy-land/equals';
|
|
2
|
+
export var lte = 'fantasy-land/lte';
|
|
3
|
+
export var compose = 'fantasy-land/compose';
|
|
4
|
+
export var id = 'fantasy-land/id';
|
|
5
|
+
export var concat = 'fantasy-land/concat';
|
|
6
|
+
export var empty = 'fantasy-land/empty';
|
|
7
|
+
export var map = 'fantasy-land/map';
|
|
8
|
+
export var contramap = 'fantasy-land/contramap';
|
|
9
|
+
export var ap = 'fantasy-land/ap';
|
|
10
|
+
export var of = 'fantasy-land/of';
|
|
11
|
+
export var alt = 'fantasy-land/alt';
|
|
12
|
+
export var zero = 'fantasy-land/zero';
|
|
13
|
+
export var reduce = 'fantasy-land/reduce';
|
|
14
|
+
export var traverse = 'fantasy-land/traverse';
|
|
15
|
+
export var chain = 'fantasy-land/chain';
|
|
16
|
+
export var chainRec = 'fantasy-land/chainRec';
|
|
17
|
+
export var extend = 'fantasy-land/extend';
|
|
18
|
+
export var extract = 'fantasy-land/extract';
|
|
19
|
+
export var bimap = 'fantasy-land/bimap';
|
|
20
|
+
export var promap = 'fantasy-land/promap';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
import { equals, pathSatisfies } from 'ramda';
|
|
4
|
+
import isString from '../isString';
|
|
5
|
+
import isNumber from '../isNumber';
|
|
6
|
+
import isFunction from '../isFunction';
|
|
7
|
+
import { isSameType } from './util';
|
|
8
|
+
import * as fl from './mapping';
|
|
9
|
+
export var functorTrait = _defineProperty({}, fl.map, function (fn) {
|
|
10
|
+
return this.constructor[fl.of](fn(this.value));
|
|
11
|
+
});
|
|
12
|
+
export var applyTrait = _defineProperty({}, fl.ap, function (applyWithFn) {
|
|
13
|
+
var _this = this;
|
|
14
|
+
|
|
15
|
+
return applyWithFn.map(function (fn) {
|
|
16
|
+
return fn(_this.value);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
export var setoidTrait = _defineProperty({}, fl.equals, function (setoid) {
|
|
20
|
+
return isSameType(this, setoid) && equals(this.value, setoid.value);
|
|
21
|
+
});
|
|
22
|
+
export var semigroupTrait = _defineProperty({}, fl.concat, function (semigroup) {
|
|
23
|
+
var concatenatedValue = this.value;
|
|
24
|
+
|
|
25
|
+
if (isString(this.value) || isNumber(this.value)) {
|
|
26
|
+
concatenatedValue = this.value + semigroup.value;
|
|
27
|
+
} else if (pathSatisfies(isFunction, ['value', fl.concat], this)) {
|
|
28
|
+
concatenatedValue = this.value[fl.concat](semigroup.value);
|
|
29
|
+
} else if (pathSatisfies(isFunction, ['value', 'concat'], this)) {
|
|
30
|
+
concatenatedValue = this.value.concat(semigroup.value);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return this.constructor[fl.of](concatenatedValue);
|
|
34
|
+
});
|
|
35
|
+
export var chainTrait = _defineProperty({}, fl.chain, function (fn) {
|
|
36
|
+
var newChain = fn(this.value);
|
|
37
|
+
return isSameType(this, newChain) ? newChain : this;
|
|
38
|
+
});
|
|
39
|
+
export var ordTrait = _defineProperty({}, fl.lte, function (ord) {
|
|
40
|
+
return isSameType(this, ord) && (this.value < ord.value || this[fl.equals](ord));
|
|
41
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useWith, curry, curryN, equals, path, either, complement } from 'ramda'; // type :: Monad a => a -> String
|
|
2
|
+
|
|
3
|
+
export var type = either(path(['@@type']), path(['constructor', '@@type'])); // typeEquals :: Monad a => String -> a -> Boolean
|
|
4
|
+
|
|
5
|
+
export var typeEquals = curry(function (typeIdent, monad) {
|
|
6
|
+
return type(monad) === typeIdent;
|
|
7
|
+
}); // isSameType :: (Monad a, Monad b) => a -> b -> Boolean
|
|
8
|
+
|
|
9
|
+
export var isSameType = curryN(2, useWith(equals, [type, type])); // isNotSameType :: (Monad a, Monad b) => a -> b -> Boolean
|
|
10
|
+
|
|
11
|
+
export var isNotSameType = complement(isSameType);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { addIndex, filter } from 'ramda';
|
|
2
|
+
/**
|
|
3
|
+
* {@link http://ramdajs.com/docs/#filter|R.filter} function that more closely resembles `Array.prototype.filter`.
|
|
4
|
+
* It takes two new parameters to its callback function: the current index, and the entire list.
|
|
5
|
+
*
|
|
6
|
+
* `filterIndexed` implementation is simple: `
|
|
7
|
+
* const filterIndexed = R.addIndex(R.filter);
|
|
8
|
+
* `
|
|
9
|
+
*
|
|
10
|
+
* @func filterIndexed
|
|
11
|
+
* @memberOf RA
|
|
12
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/2.31.0|v2.31.0}
|
|
13
|
+
* @category List
|
|
14
|
+
* @typedef Idx = Number
|
|
15
|
+
* @sig Filterable f => ((a, Idx, f a) -> Boolean) -> f a -> f a
|
|
16
|
+
* @param {Function} pred The predicate function
|
|
17
|
+
* @param {Array} list The collection to filter
|
|
18
|
+
* @return {Array} Filterable
|
|
19
|
+
* @see {@link http://ramdajs.com/docs/#addIndex|R.addIndex}, {@link http://ramdajs.com/docs/#filter|R.filter}
|
|
20
|
+
* @example
|
|
21
|
+
*
|
|
22
|
+
* const isValueGtIndex = (val, idx) => val > idx;
|
|
23
|
+
* RA.filterIndexed(isValueGtIndex, [5, 4, 3, 2, 1, 0]); //=> [5, 4, 3]
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
var filterIndexed = addIndex(filter);
|
|
27
|
+
export default filterIndexed;
|
package/es/findOr.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { pipe, curry, find, defaultTo } from 'ramda';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the first element of the list which matches the predicate.
|
|
4
|
+
* Returns default value if no element matches or matched element is `null`, `undefined` or `NaN`.
|
|
5
|
+
* Dispatches to the find method of the second argument, if present.
|
|
6
|
+
* Acts as a transducer if a transformer is given in list position.
|
|
7
|
+
*
|
|
8
|
+
* @func findOr
|
|
9
|
+
* @memberOf RA
|
|
10
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/2.32.0|v2.32.0}
|
|
11
|
+
* @category List
|
|
12
|
+
* @sig a -> (b -> Boolean) -> [b] -> b | a
|
|
13
|
+
* @param {*} defaultValue The default value
|
|
14
|
+
* @param {Function} fn The predicate function used to determine if the element is the desired one.
|
|
15
|
+
* @param {Array} list The array to consider.
|
|
16
|
+
* @return {*} The element found, or the default value.
|
|
17
|
+
* @see {@link http://ramdajs.com/docs/#defaultTo|R.defaultTo}, {@link http://ramdajs.com/docs/#find|R.find}
|
|
18
|
+
* @example
|
|
19
|
+
*
|
|
20
|
+
* RA.findOr(1, isUndefined, [1, 2, undefined]); // => 1
|
|
21
|
+
* RA.findOr(1, val => val === 2, [1, 2, undefined]); // => 2
|
|
22
|
+
* RA.findOr(1, val => val === 3, [1, 2, undefined]); // => 1
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
var findOr = curry(function (defaultVal, fn, list) {
|
|
26
|
+
return pipe(find(fn), defaultTo(defaultVal))(list);
|
|
27
|
+
});
|
|
28
|
+
export default findOr;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
|
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
+
|
|
9
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
+
|
|
11
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
12
|
+
|
|
13
|
+
import { curry } from 'ramda';
|
|
14
|
+
import _makeFlat from './internal/makeFlat';
|
|
15
|
+
|
|
16
|
+
var flatten1 = _makeFlat(false);
|
|
17
|
+
/**
|
|
18
|
+
* Flattens the list to the specified depth.
|
|
19
|
+
*
|
|
20
|
+
* @func flattenDepth
|
|
21
|
+
* @memberOf RA
|
|
22
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/2.19.0|v2.19.0}
|
|
23
|
+
* @category List
|
|
24
|
+
* @sig Number -> [a] -> [b]
|
|
25
|
+
* @param {!number} depth The maximum recursion depth
|
|
26
|
+
* @param {!Array} list The array to flatten
|
|
27
|
+
* @return {!Array} Returns the new flattened array
|
|
28
|
+
* @see {@link http://ramdajs.com/docs/#flatten|R.flatten}, {@link http://ramdajs.com/docs/#unnest|R.unnest}
|
|
29
|
+
* @example
|
|
30
|
+
*
|
|
31
|
+
* RA.flattenDepth(
|
|
32
|
+
* 2,
|
|
33
|
+
* [1, [2], [3, [4, 5], 6, [[[7], 8]]], 9, 10]
|
|
34
|
+
* ); //=> [1, 2, 3, 4, 5, 6, [[7], 8], 9, 10];
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
var flattenDepth = curry(function (depth, list) {
|
|
39
|
+
var currentDept = depth;
|
|
40
|
+
|
|
41
|
+
var flatList = _toConsumableArray(list);
|
|
42
|
+
|
|
43
|
+
while (currentDept > 0) {
|
|
44
|
+
flatList = flatten1(flatList);
|
|
45
|
+
currentDept -= 1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return flatList;
|
|
49
|
+
});
|
|
50
|
+
export default flattenDepth;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { pathOr, curry, merge } from 'ramda';
|
|
2
|
+
/**
|
|
3
|
+
* Flattens a property path so that its fields are spread out into the provided object.
|
|
4
|
+
* It's like {@link RA.spreadPath|spreadPath}, but preserves object under the property path.
|
|
5
|
+
*
|
|
6
|
+
* @func flattenPath
|
|
7
|
+
* @memberOf RA
|
|
8
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/1.19.0|v1.19.0}
|
|
9
|
+
* @category Object
|
|
10
|
+
* @typedef Idx = String | Int
|
|
11
|
+
* @sig [Idx] -> {k: v} -> {k: v}
|
|
12
|
+
* @param {!Array.<string|number>} path The property path to flatten
|
|
13
|
+
* @param {!Object} obj The provided object
|
|
14
|
+
* @return {!Object} The flattened object
|
|
15
|
+
* @see {@link RA.flattenProp|flattenProp}, {@link RA.spreadPath|spreadPath}
|
|
16
|
+
* @example
|
|
17
|
+
*
|
|
18
|
+
* RA.flattenPath(
|
|
19
|
+
* ['b1', 'b2'],
|
|
20
|
+
* { a: 1, b1: { b2: { c: 3, d: 4 } } }
|
|
21
|
+
* ); // => { a: 1, c: 3, d: 4, b1: { b2: { c: 3, d: 4 } } };
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
var flattenPath = curry(function (path, obj) {
|
|
25
|
+
return merge(obj, pathOr({}, path, obj));
|
|
26
|
+
});
|
|
27
|
+
export default flattenPath;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { of, curry } from 'ramda';
|
|
2
|
+
import flattenPath from './flattenPath';
|
|
3
|
+
/**
|
|
4
|
+
* Flattens a property so that its fields are spread out into the provided object.
|
|
5
|
+
* It's like {@link RA.spreadProp|spreadProp}, but preserves object under the property path.
|
|
6
|
+
*
|
|
7
|
+
* @func flattenProp
|
|
8
|
+
* @memberOf RA
|
|
9
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/1.19.0|v1.19.0}
|
|
10
|
+
* @category Object
|
|
11
|
+
* @typedef Idx = String | Int
|
|
12
|
+
* @sig [Idx] -> {k: v} -> {k: v}
|
|
13
|
+
* @param {!string|number} prop The property to flatten
|
|
14
|
+
* @param {!Object} obj The provided object
|
|
15
|
+
* @return {!Object} The flattened object
|
|
16
|
+
* @see {@link RA.flattenPath|flattenPath}, {@link RA.spreadProp|spreadProp}
|
|
17
|
+
* @example
|
|
18
|
+
*
|
|
19
|
+
* RA.flattenProp(
|
|
20
|
+
* 'b',
|
|
21
|
+
* { a: 1, b: { c: 3, d: 4 } }
|
|
22
|
+
* ); // => { a: 1, c: 3, d: 4, b: { c: 3, d: 4 } };
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
var flattenProp = curry(function (prop, obj) {
|
|
26
|
+
return flattenPath(of(prop), obj);
|
|
27
|
+
});
|
|
28
|
+
export default flattenProp;
|
package/es/floor.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { bind, curryN } from 'ramda';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the largest integer less than or equal to a given number.
|
|
4
|
+
*
|
|
5
|
+
* Note: floor(null) returns integer 0 and do not give a NaN error.
|
|
6
|
+
*
|
|
7
|
+
* @func floor
|
|
8
|
+
* @memberOf RA
|
|
9
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/2.15.0|v2.15.0}
|
|
10
|
+
* @category Math
|
|
11
|
+
* @sig Number -> Number
|
|
12
|
+
* @param {number} number The number to floor
|
|
13
|
+
* @return {number} A number representing the largest integer less than or equal to the specified number
|
|
14
|
+
* @example
|
|
15
|
+
*
|
|
16
|
+
* RA.floor(45.95); //=> 45
|
|
17
|
+
* RA.floor(45.05); //=> 45
|
|
18
|
+
* RA.floor(4); //=> 4
|
|
19
|
+
* RA.floor(-45.05); //=> -46
|
|
20
|
+
* RA.floor(-45.95); //=> -46
|
|
21
|
+
* RA.floor(null); //=> 0
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
var floor = curryN(1, bind(Math.floor, Math));
|
|
25
|
+
export default floor;
|
package/es/fnull.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { isNil, curryN, curry, apply } from 'ramda';
|
|
2
|
+
import defaultWhen from './defaultWhen';
|
|
3
|
+
import mapIndexed from './mapIndexed';
|
|
4
|
+
/**
|
|
5
|
+
* Returns a function which is called with the given arguments. If any of the given arguments are null or undefined,
|
|
6
|
+
* the corresponding default value for that argument is used instead.
|
|
7
|
+
*
|
|
8
|
+
* @func fnull
|
|
9
|
+
* @memberOf RA
|
|
10
|
+
* @category Function
|
|
11
|
+
* @sig (a ... -> b) -> [c] -> a ... | c -> b
|
|
12
|
+
* @param {Function} function to be executed
|
|
13
|
+
* @param {Array} defaults default arguments
|
|
14
|
+
* @return {Function} will apply provided arguments or default ones
|
|
15
|
+
* @example
|
|
16
|
+
*
|
|
17
|
+
* const addDefaults = RA.fnull((a, b) => a + b, [4, 5])
|
|
18
|
+
*
|
|
19
|
+
* addDefaults(1, 2); // => 3
|
|
20
|
+
* addDefaults(null, 2); // => 6
|
|
21
|
+
* addDefaults(2, null); // => 7
|
|
22
|
+
* addDefaults(undefined, undefined); // => 9
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
var fnull = curry(function (fn, defaults) {
|
|
26
|
+
return curryN(fn.length, function () {
|
|
27
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
28
|
+
args[_key] = arguments[_key];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var argsWithDefaults = mapIndexed(function (val, idx) {
|
|
32
|
+
return defaultWhen(isNil, defaults[idx], val);
|
|
33
|
+
}, args);
|
|
34
|
+
return apply(fn, argsWithDefaults);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
export default fnull;
|
package/es/hasPath.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { length, has, path, head, tail, curryN } from 'ramda';
|
|
2
|
+
import isObj from './isObj';
|
|
3
|
+
/**
|
|
4
|
+
* Returns whether or not an object has an own property with the specified name at a given path.
|
|
5
|
+
*
|
|
6
|
+
* @func hasPath
|
|
7
|
+
* @memberOf RA
|
|
8
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/1.14.0|v1.14.0}
|
|
9
|
+
* @deprecated since v2.12.0; ramda@0.26.0 contains hasPath
|
|
10
|
+
* @category Object
|
|
11
|
+
* @typedef Idx = String | Int
|
|
12
|
+
* @sig [Idx] -> {a} -> Boolean
|
|
13
|
+
* @param {Array.<string|number>} path The path of the nested property
|
|
14
|
+
* @param {Object} obj The object to test
|
|
15
|
+
* @return {boolean}
|
|
16
|
+
* @see {@link http://ramdajs.com/docs/#has|R.has}
|
|
17
|
+
* @example
|
|
18
|
+
*
|
|
19
|
+
* RA.hasPath(['a', 'b'], { a: { b: 1 } }); //=> true
|
|
20
|
+
* RA.hasPath(['a', 'b', 'c'], { a: { b: 1 } }); //=> false
|
|
21
|
+
* RA.hasPath(['a', 'b'], { a: { } }); //=> false
|
|
22
|
+
* RA.hasPath([0], [1, 2]); //=> true
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
var hasPath = curryN(2, function (objPath, obj) {
|
|
26
|
+
var prop = head(objPath); // termination conditions
|
|
27
|
+
|
|
28
|
+
if (length(objPath) === 0 || !isObj(obj)) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (length(objPath) === 1) {
|
|
33
|
+
return has(prop, obj);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return hasPath(tail(objPath), path([prop], obj)); // base case
|
|
37
|
+
});
|
|
38
|
+
export default hasPath;
|
package/es/inRange.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ifElse, curry, useWith, both, gte, lte, gt } from 'ramda';
|
|
2
|
+
var inRangeImp = ifElse(gte, function () {
|
|
3
|
+
throw new Error('low must not be greater than high in inRange(low, high, value)');
|
|
4
|
+
}, useWith(both, [lte, gt]));
|
|
5
|
+
/**
|
|
6
|
+
* Checks if `value` is between `low` and up to but not including `high`.
|
|
7
|
+
*
|
|
8
|
+
* @func inRange
|
|
9
|
+
* @memberOf RA
|
|
10
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/2.7.0|v2.7.0}
|
|
11
|
+
* @category Relation
|
|
12
|
+
* @sig Number -> Number -> Number -> Boolean
|
|
13
|
+
* @param {number} low Start of the range
|
|
14
|
+
* @param {number} high The end of the range
|
|
15
|
+
* @param {number} value The value to test
|
|
16
|
+
* @return {boolean}
|
|
17
|
+
* @throws {Error} When `low` is greater than or equal to `high`
|
|
18
|
+
* @example
|
|
19
|
+
*
|
|
20
|
+
* RA.inRange(0, 5, 3); //=> true
|
|
21
|
+
* RA.inRange(0, 5, 0); //=> true
|
|
22
|
+
* RA.inRange(0, 5, 4); //=> true
|
|
23
|
+
* RA.inRange(0, 5, 5); //=> false
|
|
24
|
+
* RA.inRange(0, 5, -1); //=> false
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
export default curry(function (low, high, value) {
|
|
28
|
+
return inRangeImp(low, high)(value);
|
|
29
|
+
});
|