ramda-adjunct 5.0.0 → 5.0.1
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/CHANGELOG.md +7 -0
- package/README.md +1 -1
- package/dist/RA.node.js +10444 -452
- package/dist/RA.node.min.js +1 -1
- package/dist/RA.web.js +10444 -452
- package/dist/RA.web.min.js +1 -1
- package/dist/RA.web.standalone.js +18665 -447
- package/dist/RA.web.standalone.min.js +1 -1
- package/dist/package.json +1 -0
- package/es/copyKeys.js +1 -1
- package/es/dispatch.js +5 -5
- package/es/fantasy-land/Identity.js +3 -3
- package/es/fantasy-land/traits.js +1 -1
- package/es/flattenDepth.js +5 -5
- package/es/internal/ponyfills/Array.from.js +5 -5
- package/es/internal/ponyfills/Promise.allSettled.js +5 -5
- package/es/internal/ponyfills/Promise.any.js +15 -15
- package/es/lastP.js +5 -5
- package/es/reduceP.js +4 -4
- package/es/reduceRightP.js +4 -4
- package/es/renameKey.js +1 -1
- package/es/sortByProps.js +5 -5
- package/lib/allEqual.js +1 -1
- package/lib/allIdentical.js +1 -1
- package/lib/allSettledP.js +1 -1
- package/lib/allUnique.js +1 -1
- package/lib/anyP.js +1 -1
- package/lib/argsPass.js +1 -1
- package/lib/async.js +1 -1
- package/lib/cata.js +1 -1
- package/lib/compact.js +1 -1
- package/lib/concatAll.js +1 -1
- package/lib/copyKeys.js +2 -2
- package/lib/curryRight.js +1 -1
- package/lib/delayP.js +1 -1
- package/lib/dispatch.js +6 -6
- package/lib/ensureArray.js +1 -1
- package/lib/escapeRegExp.js +1 -1
- package/lib/fantasy-land/Identity.js +3 -3
- package/lib/fantasy-land/traits.js +2 -2
- package/lib/flattenDepth.js +6 -6
- package/lib/flattenProp.js +1 -1
- package/lib/fnull.js +1 -1
- package/lib/index.js +1 -1
- package/lib/internal/ap.js +1 -1
- package/lib/internal/isCoercible.js +1 -1
- package/lib/internal/makeFlat.js +1 -1
- package/lib/internal/ponyfills/Array.from.js +6 -6
- package/lib/internal/ponyfills/Math.trunc.js +1 -1
- package/lib/internal/ponyfills/Number.isFinite.js +1 -1
- package/lib/internal/ponyfills/Number.isInteger.js +1 -1
- package/lib/internal/ponyfills/Number.isNaN.js +1 -1
- package/lib/internal/ponyfills/Number.isSafeInteger.js +1 -1
- package/lib/internal/ponyfills/Promise.allSettled.js +6 -6
- package/lib/internal/ponyfills/Promise.any.js +16 -16
- package/lib/internal/ponyfills/String.padEnd.js +1 -1
- package/lib/internal/ponyfills/String.padStart.js +1 -1
- package/lib/internal/ponyfills/String.repeat.js +1 -1
- package/lib/internal/ponyfills/String.replaceAll.js +1 -1
- package/lib/invoke.js +1 -1
- package/lib/invokeArgs.js +1 -1
- package/lib/isArray.js +1 -1
- package/lib/isArrayLike.js +1 -1
- package/lib/isBlank.js +1 -1
- package/lib/isEmptyArray.js +1 -1
- package/lib/isEven.js +1 -1
- package/lib/isFalsy.js +1 -1
- package/lib/isFinite.js +1 -1
- package/lib/isFloat.js +1 -1
- package/lib/isFunction.js +1 -1
- package/lib/isIndexed.js +1 -1
- package/lib/isInteger.js +1 -1
- package/lib/isInteger32.js +1 -1
- package/lib/isIterable.js +1 -1
- package/lib/isNaN.js +1 -1
- package/lib/isNaturalNumber.js +1 -1
- package/lib/isNegative.js +1 -1
- package/lib/isNonEmptyArray.js +1 -1
- package/lib/isNonEmptyString.js +1 -1
- package/lib/isNonNegative.js +1 -1
- package/lib/isNonPositive.js +1 -1
- package/lib/isNotArray.js +1 -1
- package/lib/isNotArrayLike.js +1 -1
- package/lib/isNotAsyncFunction.js +1 -1
- package/lib/isNotBoolean.js +1 -1
- package/lib/isNotDate.js +1 -1
- package/lib/isNotFinite.js +1 -1
- package/lib/isNotFloat.js +1 -1
- package/lib/isNotFunction.js +1 -1
- package/lib/isNotGeneratorFunction.js +1 -1
- package/lib/isNotInteger.js +1 -1
- package/lib/isNotMap.js +1 -1
- package/lib/isNotNaN.js +1 -1
- package/lib/isNotNilOrEmpty.js +1 -1
- package/lib/isNotNull.js +1 -1
- package/lib/isNotNumber.js +1 -1
- package/lib/isNotObj.js +1 -1
- package/lib/isNotObjLike.js +1 -1
- package/lib/isNotPair.js +1 -1
- package/lib/isNotPlainObj.js +1 -1
- package/lib/isNotPrimitive.js +1 -1
- package/lib/isNotRegExp.js +1 -1
- package/lib/isNotSet.js +1 -1
- package/lib/isNotString.js +1 -1
- package/lib/isNotUndefined.js +1 -1
- package/lib/isNotValidDate.js +1 -1
- package/lib/isNotValidNumber.js +1 -1
- package/lib/isObj.js +1 -1
- package/lib/isObjLike.js +1 -1
- package/lib/isOdd.js +1 -1
- package/lib/isPair.js +1 -1
- package/lib/isPlainObj.js +1 -1
- package/lib/isPositive.js +1 -1
- package/lib/isPrimitive.js +1 -1
- package/lib/isPromise.js +1 -1
- package/lib/isPrototypeOf.js +1 -1
- package/lib/isSafeInteger.js +1 -1
- package/lib/isSentinelValue.js +1 -1
- package/lib/isSparseArray.js +1 -1
- package/lib/isThenable.js +1 -1
- package/lib/isUinteger32.js +1 -1
- package/lib/isUndefined.js +1 -1
- package/lib/isValidDate.js +1 -1
- package/lib/isValidNumber.js +1 -1
- package/lib/lastP.js +6 -6
- package/lib/lengthEq.js +1 -1
- package/lib/lengthGt.js +1 -1
- package/lib/lengthGte.js +1 -1
- package/lib/lengthLt.js +1 -1
- package/lib/lengthLte.js +1 -1
- package/lib/lengthNotEq.js +1 -1
- package/lib/lensNotEq.js +1 -1
- package/lib/lensNotSatisfy.js +1 -1
- package/lib/lensSatisfies.js +1 -1
- package/lib/lensTraverse.js +1 -1
- package/lib/liftF.js +1 -1
- package/lib/liftFN.js +1 -1
- package/lib/mergePaths.js +1 -1
- package/lib/mergeProp.js +1 -1
- package/lib/noneP.js +1 -1
- package/lib/noop.js +1 -1
- package/lib/notAllUnique.js +1 -1
- package/lib/padCharsEnd.js +1 -1
- package/lib/padCharsStart.js +1 -1
- package/lib/padEnd.js +1 -1
- package/lib/padStart.js +1 -1
- package/lib/rangeStep.js +1 -1
- package/lib/reduceP.js +5 -5
- package/lib/reduceRightP.js +5 -5
- package/lib/renameKey.js +2 -2
- package/lib/renameKeyWith.js +1 -1
- package/lib/renameKeys.js +1 -1
- package/lib/repeatStr.js +1 -1
- package/lib/replaceAll.js +1 -1
- package/lib/sign.js +1 -1
- package/lib/sortByProp.js +1 -1
- package/lib/sortByProps.js +5 -5
- package/lib/spreadProp.js +1 -1
- package/lib/toArray.js +1 -1
- package/lib/toNumber.js +1 -1
- package/lib/trimCharsEnd.js +1 -1
- package/lib/trimCharsStart.js +1 -1
- package/lib/trimEnd.js +1 -1
- package/lib/trimStart.js +1 -1
- package/lib/trunc.js +1 -1
- package/lib/unzipObjWith.js +1 -1
- package/package.json +22 -19
- package/babel.config.cjs +0 -56
- package/src/Y.js +0 -32
- package/src/allEqual.js +0 -28
- package/src/allEqualTo.js +0 -25
- package/src/allIdentical.js +0 -26
- package/src/allIdenticalTo.js +0 -25
- package/src/allP.js +0 -27
- package/src/allSettledP.js +0 -34
- package/src/allUnique.js +0 -25
- package/src/anyP.js +0 -33
- package/src/appendFlipped.js +0 -24
- package/src/argsPass.js +0 -40
- package/src/async.js +0 -60
- package/src/cata.js +0 -86
- package/src/catchP.js +0 -25
- package/src/ceil.js +0 -28
- package/src/compact.js +0 -23
- package/src/concatAll.js +0 -35
- package/src/concatRight.js +0 -30
- package/src/copyKeys.js +0 -31
- package/src/curryRight.js +0 -26
- package/src/curryRightN.js +0 -29
- package/src/defaultWhen.js +0 -26
- package/src/delayP.js +0 -45
- package/src/dispatch.js +0 -74
- package/src/divideNum.js +0 -20
- package/src/dropArgs.js +0 -23
- package/src/ensureArray.js +0 -24
- package/src/escapeRegExp.js +0 -22
- package/src/fantasy-land/Identity.js +0 -270
- package/src/fantasy-land/mapping.js +0 -20
- package/src/fantasy-land/traits.js +0 -57
- package/src/fantasy-land/util.js +0 -23
- package/src/filterIndexed.js +0 -28
- package/src/findOr.js +0 -30
- package/src/flattenDepth.js +0 -39
- package/src/flattenPath.js +0 -28
- package/src/flattenProp.js +0 -28
- package/src/floor.js +0 -27
- package/src/fnull.js +0 -38
- package/src/inRange.js +0 -34
- package/src/included.js +0 -28
- package/src/index.js +0 -241
- package/src/internal/ap.js +0 -30
- package/src/internal/compareLength.js +0 -7
- package/src/internal/isCoercible.js +0 -12
- package/src/internal/isOfTypeObject.js +0 -3
- package/src/internal/makeFlat.js +0 -42
- package/src/internal/ponyfills/Array.from.js +0 -34
- package/src/internal/ponyfills/Math.sign.js +0 -3
- package/src/internal/ponyfills/Math.trunc.js +0 -14
- package/src/internal/ponyfills/Number.MAX_SAFE_INTEGER.js +0 -3
- package/src/internal/ponyfills/Number.MIN_SAFE_INTEGER.js +0 -3
- package/src/internal/ponyfills/Number.isFinite.js +0 -8
- package/src/internal/ponyfills/Number.isInteger.js +0 -10
- package/src/internal/ponyfills/Number.isNaN.js +0 -8
- package/src/internal/ponyfills/Number.isSafeInteger.js +0 -11
- package/src/internal/ponyfills/Promise.allSettled.js +0 -18
- package/src/internal/ponyfills/Promise.any.js +0 -29
- package/src/internal/ponyfills/String.padEnd.js +0 -25
- package/src/internal/ponyfills/String.padStart.js +0 -27
- package/src/internal/ponyfills/String.repeat.js +0 -49
- package/src/internal/ponyfills/String.replaceAll.js +0 -44
- package/src/internal/ponyfills/String.trimEnd.js +0 -5
- package/src/internal/ponyfills/String.trimStart.js +0 -5
- package/src/invoke.js +0 -22
- package/src/invokeArgs.js +0 -36
- package/src/isArray.js +0 -27
- package/src/isArrayLike.js +0 -79
- package/src/isAsyncFunction.js +0 -23
- package/src/isBigInt.js +0 -24
- package/src/isBlank.js +0 -33
- package/src/isBoolean.js +0 -22
- package/src/isDate.js +0 -21
- package/src/isEmptyArray.js +0 -28
- package/src/isEmptyString.js +0 -28
- package/src/isError.js +0 -21
- package/src/isEven.js +0 -31
- package/src/isFalse.js +0 -31
- package/src/isFalsy.js +0 -28
- package/src/isFinite.js +0 -37
- package/src/isFloat.js +0 -36
- package/src/isFunction.js +0 -32
- package/src/isGeneratorFunction.js +0 -26
- package/src/isIndexed.js +0 -24
- package/src/isInteger.js +0 -40
- package/src/isInteger32.js +0 -28
- package/src/isIterable.js +0 -37
- package/src/isMap.js +0 -25
- package/src/isNaN.js +0 -45
- package/src/isNaturalNumber.js +0 -28
- package/src/isNegative.js +0 -27
- package/src/isNegativeZero.js +0 -23
- package/src/isNilOrEmpty.js +0 -26
- package/src/isNonEmptyArray.js +0 -28
- package/src/isNonEmptyString.js +0 -31
- package/src/isNonNegative.js +0 -30
- package/src/isNonPositive.js +0 -30
- package/src/isNotArray.js +0 -24
- package/src/isNotArrayLike.js +0 -26
- package/src/isNotAsyncFunction.js +0 -27
- package/src/isNotBoolean.js +0 -24
- package/src/isNotDate.js +0 -23
- package/src/isNotFinite.js +0 -31
- package/src/isNotFloat.js +0 -35
- package/src/isNotFunction.js +0 -29
- package/src/isNotGeneratorFunction.js +0 -27
- package/src/isNotInteger.js +0 -36
- package/src/isNotMap.js +0 -27
- package/src/isNotNaN.js +0 -37
- package/src/isNotNil.js +0 -23
- package/src/isNotNilOrEmpty.js +0 -28
- package/src/isNotNull.js +0 -24
- package/src/isNotNumber.js +0 -25
- package/src/isNotObj.js +0 -29
- package/src/isNotObjLike.js +0 -29
- package/src/isNotPair.js +0 -27
- package/src/isNotPlainObj.js +0 -35
- package/src/isNotPrimitive.js +0 -26
- package/src/isNotRegExp.js +0 -24
- package/src/isNotSet.js +0 -26
- package/src/isNotString.js +0 -23
- package/src/isNotUndefined.js +0 -24
- package/src/isNotValidDate.js +0 -24
- package/src/isNotValidNumber.js +0 -27
- package/src/isNull.js +0 -22
- package/src/isNumber.js +0 -24
- package/src/isObj.js +0 -31
- package/src/isObjLike.js +0 -30
- package/src/isOdd.js +0 -29
- package/src/isPair.js +0 -27
- package/src/isPlainObj.js +0 -65
- package/src/isPositive.js +0 -26
- package/src/isPositiveZero.js +0 -23
- package/src/isPrimitive.js +0 -46
- package/src/isPromise.js +0 -32
- package/src/isPrototypeOf.js +0 -36
- package/src/isRegExp.js +0 -22
- package/src/isSafeInteger.js +0 -40
- package/src/isSentinelValue.js +0 -26
- package/src/isSet.js +0 -24
- package/src/isSparseArray.js +0 -43
- package/src/isString.js +0 -21
- package/src/isSymbol.js +0 -29
- package/src/isThenable.js +0 -28
- package/src/isTrue.js +0 -27
- package/src/isTruthy.js +0 -28
- package/src/isUinteger32.js +0 -29
- package/src/isUndefined.js +0 -24
- package/src/isValidDate.js +0 -29
- package/src/isValidNumber.js +0 -28
- package/src/lastP.js +0 -54
- package/src/lengthEq.js +0 -24
- package/src/lengthGt.js +0 -24
- package/src/lengthGte.js +0 -26
- package/src/lengthLt.js +0 -24
- package/src/lengthLte.js +0 -25
- package/src/lengthNotEq.js +0 -24
- package/src/lensEq.js +0 -28
- package/src/lensIso.js +0 -51
- package/src/lensNotEq.js +0 -28
- package/src/lensNotSatisfy.js +0 -30
- package/src/lensSatisfies.js +0 -33
- package/src/lensTraverse.js +0 -56
- package/src/liftF.js +0 -37
- package/src/liftFN.js +0 -45
- package/src/list.js +0 -20
- package/src/mapIndexed.js +0 -27
- package/src/mergePath.js +0 -30
- package/src/mergePaths.js +0 -29
- package/src/mergeProp.js +0 -30
- package/src/mergeProps.js +0 -27
- package/src/move.js +0 -26
- package/src/nand.js +0 -27
- package/src/neither.js +0 -38
- package/src/noneP.js +0 -35
- package/src/nonePass.js +0 -32
- package/src/noop.js +0 -21
- package/src/nor.js +0 -28
- package/src/notAllPass.js +0 -32
- package/src/notAllUnique.js +0 -25
- package/src/notBoth.js +0 -38
- package/src/notEqual.js +0 -31
- package/src/omitBy.js +0 -25
- package/src/omitIndexes.js +0 -27
- package/src/overlaps.js +0 -30
- package/src/padCharsEnd.js +0 -37
- package/src/padCharsStart.js +0 -35
- package/src/padEnd.js +0 -25
- package/src/padStart.js +0 -23
- package/src/pathNotEq.js +0 -31
- package/src/pathOrLazy.js +0 -30
- package/src/paths.js +0 -26
- package/src/pickIndexes.js +0 -30
- package/src/propNotEq.js +0 -30
- package/src/rangeStep.js +0 -37
- package/src/reduceIndexed.js +0 -31
- package/src/reduceP.js +0 -96
- package/src/reduceRightP.js +0 -101
- package/src/rejectP.js +0 -24
- package/src/renameKey.js +0 -33
- package/src/renameKeyWith.js +0 -30
- package/src/renameKeys.js +0 -40
- package/src/renameKeysWith.js +0 -27
- package/src/repeatStr.js +0 -30
- package/src/replaceAll.js +0 -35
- package/src/resolveP.js +0 -28
- package/src/round.js +0 -26
- package/src/seq.js +0 -38
- package/src/sign.js +0 -33
- package/src/skipTake.js +0 -33
- package/src/sliceFrom.js +0 -23
- package/src/sliceTo.js +0 -23
- package/src/sortByPaths.js +0 -55
- package/src/sortByProp.js +0 -45
- package/src/sortByProps.js +0 -31
- package/src/spreadPath.js +0 -26
- package/src/spreadProp.js +0 -25
- package/src/stubArray.js +0 -18
- package/src/stubNull.js +0 -19
- package/src/stubObj.js +0 -19
- package/src/stubString.js +0 -19
- package/src/stubUndefined.js +0 -19
- package/src/subtractNum.js +0 -20
- package/src/thenCatchP.js +0 -27
- package/src/toArray.js +0 -32
- package/src/toInteger32.js +0 -22
- package/src/toNumber.js +0 -24
- package/src/toUinteger32.js +0 -26
- package/src/trimCharsEnd.js +0 -25
- package/src/trimCharsStart.js +0 -25
- package/src/trimEnd.js +0 -30
- package/src/trimStart.js +0 -29
- package/src/trunc.js +0 -33
- package/src/unzipObjWith.js +0 -40
- package/src/viewOr.js +0 -32
- package/src/weave.js +0 -35
- package/src/weaveLazy.js +0 -37
- package/src/zipObjWith.js +0 -27
package/babel.config.cjs
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
env: {
|
|
5
|
-
commonjs: {
|
|
6
|
-
presets: [
|
|
7
|
-
[
|
|
8
|
-
'@babel/preset-env',
|
|
9
|
-
{
|
|
10
|
-
modules: 'commonjs',
|
|
11
|
-
forceAllTransforms: true,
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
],
|
|
15
|
-
plugins: [
|
|
16
|
-
[
|
|
17
|
-
'@babel/plugin-transform-modules-commonjs',
|
|
18
|
-
{
|
|
19
|
-
loose: true,
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
],
|
|
23
|
-
},
|
|
24
|
-
es: {
|
|
25
|
-
presets: [
|
|
26
|
-
[
|
|
27
|
-
'@babel/preset-env',
|
|
28
|
-
{
|
|
29
|
-
modules: false,
|
|
30
|
-
forceAllTransforms: true,
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
],
|
|
34
|
-
},
|
|
35
|
-
coverage: {
|
|
36
|
-
presets: [
|
|
37
|
-
[
|
|
38
|
-
'@babel/preset-env',
|
|
39
|
-
{
|
|
40
|
-
modules: 'commonjs',
|
|
41
|
-
forceAllTransforms: true,
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
],
|
|
45
|
-
plugins: [
|
|
46
|
-
'istanbul',
|
|
47
|
-
[
|
|
48
|
-
'@babel/plugin-transform-modules-commonjs',
|
|
49
|
-
{
|
|
50
|
-
loose: true,
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
],
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
};
|
package/src/Y.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { curryN } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Y-combinator
|
|
5
|
-
*
|
|
6
|
-
* The Y combinator is an interesting function which only works with functional languages,
|
|
7
|
-
* showing how recursion can still be done even without any variable or function declarations,
|
|
8
|
-
* only functions and parameters
|
|
9
|
-
*
|
|
10
|
-
* @func Y
|
|
11
|
-
* @memberOf RA
|
|
12
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.3.0|v2.3.0}
|
|
13
|
-
* @category Function
|
|
14
|
-
* @sig (a, ... -> b -> b) -> (a, ... -> b)
|
|
15
|
-
* @param {Function} le Recursive function maker
|
|
16
|
-
* @return {Function}
|
|
17
|
-
* @see {@link http://kestas.kuliukas.com/YCombinatorExplained/|Y combinator explained}
|
|
18
|
-
* @example
|
|
19
|
-
*
|
|
20
|
-
* const makeFact = givenFact => (n) => {
|
|
21
|
-
* if (n < 2) { return 1 }
|
|
22
|
-
* return n * givenFact(n - 1);
|
|
23
|
-
* };
|
|
24
|
-
*
|
|
25
|
-
* const factorial = RA.Y(makeFact);
|
|
26
|
-
*
|
|
27
|
-
* factorial(5); //=> 120
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
const Y = curryN(1, (le) => ((f) => f(f))((g) => le((x) => g(g)(x))));
|
|
31
|
-
|
|
32
|
-
export default Y;
|
package/src/allEqual.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { pipe, uniq, curryN } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import lengthLte from './lengthLte.js';
|
|
4
|
-
|
|
5
|
-
// Original idea for this function was conceived by https://github.com/jackmellis
|
|
6
|
-
// in https://github.com/char0n/ramda-adjunct/pull/513.
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Returns true if all items in the list are equivalent using `R.equals` for equality comparisons.
|
|
10
|
-
*
|
|
11
|
-
* @func allEqual
|
|
12
|
-
* @memberOf RA
|
|
13
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.9.0|v2.9.0}
|
|
14
|
-
* @category List
|
|
15
|
-
* @sig [a] -> Boolean
|
|
16
|
-
* @param {Array} list The list of values
|
|
17
|
-
* @return {boolean}
|
|
18
|
-
* @see {@link https://ramdajs.com/docs/#equals|equals}
|
|
19
|
-
* @example
|
|
20
|
-
*
|
|
21
|
-
* RA.allEqual([ 1, 2, 3, 4 ]); //=> false
|
|
22
|
-
* RA.allEqual([ 1, 1, 1, 1 ]); //=> true
|
|
23
|
-
* RA.allEqual([]); //=> true
|
|
24
|
-
*
|
|
25
|
-
*/
|
|
26
|
-
const allEqual = curryN(1, pipe(uniq, lengthLte(1)));
|
|
27
|
-
|
|
28
|
-
export default allEqual;
|
package/src/allEqualTo.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { all, equals, curry } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns true if all items in the list are equivalent to user provided value using `R.equals` for equality comparisons.
|
|
5
|
-
*
|
|
6
|
-
* @func allEqualTo
|
|
7
|
-
* @memberOf RA
|
|
8
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.11.0|v2.11.0}
|
|
9
|
-
* @category List
|
|
10
|
-
* @sig a -> [b] -> Boolean
|
|
11
|
-
* @param {*} val User provided value to check the `list` against
|
|
12
|
-
* @param {Array} list The list of values
|
|
13
|
-
* @return {boolean}
|
|
14
|
-
* @see {@link RA.allEqual|allEqual}, {@link https://ramdajs.com/docs/#equals|equals}
|
|
15
|
-
* @example
|
|
16
|
-
*
|
|
17
|
-
* RA.allEqualTo(1, [ 1, 2, 3, 4 ]); //=> false
|
|
18
|
-
* RA.allEqualTo(1, [ 1, 1, 1, 1 ]); //=> true
|
|
19
|
-
* RA.allEqualTo({}, [ {}, {} ]); //=> true
|
|
20
|
-
* RA.allEqualTo(1, []); //=> true
|
|
21
|
-
*
|
|
22
|
-
*/
|
|
23
|
-
const allEqualTo = curry((val, list) => all(equals(val), list));
|
|
24
|
-
|
|
25
|
-
export default allEqualTo;
|
package/src/allIdentical.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { uniqWith, identical, pipe, curryN } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import lengthLte from './lengthLte.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Returns true if all items in the list are equivalent using `R.identical` for equality comparisons.
|
|
7
|
-
*
|
|
8
|
-
* @func allIdentical
|
|
9
|
-
* @memberOf RA
|
|
10
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.11.0|v2.11.0}
|
|
11
|
-
* @category List
|
|
12
|
-
* @sig [a] -> Boolean
|
|
13
|
-
* @param {Array} list The list of values
|
|
14
|
-
* @return {boolean}
|
|
15
|
-
* @see {@link https://ramdajs.com/docs/#identical|identical}
|
|
16
|
-
* @example
|
|
17
|
-
*
|
|
18
|
-
* RA.allIdentical([ 1, 2, 3, 4 ]); //=> false
|
|
19
|
-
* RA.allIdentical([ 1, 1, 1, 1 ]); //=> true
|
|
20
|
-
* RA.allIdentical([]); //=> true
|
|
21
|
-
* RA.allIdentical([ {}, {} ]); //=> false
|
|
22
|
-
* RA.allIdentical([ () => {}, () => {} ]); //=> false
|
|
23
|
-
*/
|
|
24
|
-
const allIdentical = curryN(1, pipe(uniqWith(identical), lengthLte(1)));
|
|
25
|
-
|
|
26
|
-
export default allIdentical;
|
package/src/allIdenticalTo.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { curry, identical, all } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns true if all items in the list are equivalent to user provided value using `R.identical` for equality comparisons.
|
|
5
|
-
*
|
|
6
|
-
* @func allIdenticalTo
|
|
7
|
-
* @memberOf RA
|
|
8
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.11.0|v2.11.0}
|
|
9
|
-
* @category List
|
|
10
|
-
* @sig a -> [b] -> Boolean
|
|
11
|
-
* @param {*} val User provided value to check the `list` against
|
|
12
|
-
* @param {Array} list The list of values
|
|
13
|
-
* @return {boolean}
|
|
14
|
-
* @see {@link RA.allIdentical|allIdentical}, {@link http://ramdajs.com/docs/#identical|R.identical}
|
|
15
|
-
* @example
|
|
16
|
-
*
|
|
17
|
-
* RA.allIdenticalTo(1, [ 1, 2, 3, 4 ]); //=> false
|
|
18
|
-
* RA.allIdenticalTo(1, [ 1, 1, 1, 1 ]); //=> true
|
|
19
|
-
* RA.allIdenticalTo(1, []); //=> true
|
|
20
|
-
* RA.allIdenticalTo({}, [ {}, {} ]); //=> false
|
|
21
|
-
*
|
|
22
|
-
*/
|
|
23
|
-
const allIdenticalTo = curry((val, list) => all(identical(val), list));
|
|
24
|
-
|
|
25
|
-
export default allIdenticalTo;
|
package/src/allP.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { bind, curryN } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Composable shortcut for `Promise.all`.
|
|
5
|
-
*
|
|
6
|
-
* The `allP` method returns a single Promise that resolves when all of the promises
|
|
7
|
-
* in the iterable argument have resolved or when the iterable argument contains no promises.
|
|
8
|
-
* It rejects with the reason of the first promise that rejects.
|
|
9
|
-
*
|
|
10
|
-
* @func allP
|
|
11
|
-
* @memberOf RA
|
|
12
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.3.0|v2.3.0}
|
|
13
|
-
* @category Function
|
|
14
|
-
* @sig [Promise a] -> Promise [a]
|
|
15
|
-
* @param {Iterable.<*>} iterable An iterable object such as an Array or String
|
|
16
|
-
* @return {Promise} An already resolved Promise if the iterable passed is empty. An asynchronously resolved Promise if the iterable passed contains no promises. Note, Google Chrome 58 returns an already resolved promise in this case. A pending Promise in all other cases. This returned promise is then resolved/rejected asynchronously (as soon as the stack is empty) when all the promises in the given iterable have resolved, or if any of the promises reject. See the example about "Asynchronicity or synchronicity of allP" below.
|
|
17
|
-
* @see {@link RA.resolveP|resolveP}, {@link RA.rejectP|rejectP}
|
|
18
|
-
* @example
|
|
19
|
-
*
|
|
20
|
-
* RA.allP([1, 2]); //=> Promise([1, 2])
|
|
21
|
-
* RA.allP([1, Promise.resolve(2)]); //=> Promise([1, 2])
|
|
22
|
-
* RA.allP([Promise.resolve(1), Promise.resolve(2)]); //=> Promise([1, 2])
|
|
23
|
-
* RA.allP([1, Promise.reject(2)]); //=> Promise(2)
|
|
24
|
-
*/
|
|
25
|
-
const allP = curryN(1, bind(Promise.all, Promise));
|
|
26
|
-
|
|
27
|
-
export default allP;
|
package/src/allSettledP.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { bind, curryN } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import isFunction from './isFunction.js';
|
|
4
|
-
import ponyfill from './internal/ponyfills/Promise.allSettled.js';
|
|
5
|
-
|
|
6
|
-
export const allSettledPPonyfill = curryN(1, ponyfill);
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Returns a promise that is fulfilled with an array of promise state snapshots,
|
|
10
|
-
* but only after all the original promises have settled, i.e. become either fulfilled or rejected.
|
|
11
|
-
* We say that a promise is settled if it is not pending, i.e. if it is either fulfilled or rejected.
|
|
12
|
-
*
|
|
13
|
-
* @func allSettledP
|
|
14
|
-
* @memberOf RA
|
|
15
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.18.0|v2.18.0}
|
|
16
|
-
* @category Function
|
|
17
|
-
* @typedef Settlement = { status: String, value: * }
|
|
18
|
-
* @sig [Promise a] -> Promise [Settlement a]
|
|
19
|
-
* @param {Iterable.<*>} iterable An iterable object such as an Array or String
|
|
20
|
-
* @return {Promise} Returns a promise that is fulfilled with an array of promise state snapshots
|
|
21
|
-
* @see {@link RA.allP|allP}
|
|
22
|
-
* @example
|
|
23
|
-
*
|
|
24
|
-
* RA.allSettledP([
|
|
25
|
-
* Promise.resolve(1),
|
|
26
|
-
* 2,
|
|
27
|
-
* Promise.reject(3),
|
|
28
|
-
* ]); //=> Promise([{ status: 'fulfilled', value: 1 }, { status: 'fulfilled', value: 2 }, { status: 'rejected', reason: 3 }])
|
|
29
|
-
*/
|
|
30
|
-
const allSettledP = isFunction(Promise.allSettled)
|
|
31
|
-
? curryN(1, bind(Promise.allSettled, Promise))
|
|
32
|
-
: allSettledPPonyfill;
|
|
33
|
-
|
|
34
|
-
export default allSettledP;
|
package/src/allUnique.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { converge, length, uniq } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import lengthEq from './lengthEq.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Returns true if all items in the list are unique. `R.equals` is used to determine equality.
|
|
7
|
-
*
|
|
8
|
-
* @func allUnique
|
|
9
|
-
* @memberOf RA
|
|
10
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.22.0|v2.22.0}
|
|
11
|
-
* @category List
|
|
12
|
-
* @sig [a] -> Boolean
|
|
13
|
-
* @param {Array} list The list of values
|
|
14
|
-
* @return {boolean}
|
|
15
|
-
* @see {@link RA.notAllUnique|notAllUnique}, {@link https://ramdajs.com/docs/#equals|equals}
|
|
16
|
-
* @example
|
|
17
|
-
*
|
|
18
|
-
* RA.allUnique([ 1, 2, 3, 4 ]); //=> true
|
|
19
|
-
* RA.allUnique([ 1, 1, 2, 3 ]); //=> false
|
|
20
|
-
* RA.allUnique([]); //=> true
|
|
21
|
-
*
|
|
22
|
-
*/
|
|
23
|
-
const allUnique = converge(lengthEq, [length, uniq]);
|
|
24
|
-
|
|
25
|
-
export default allUnique;
|
package/src/anyP.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { bind, curryN } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import isFunction from './isFunction.js';
|
|
4
|
-
import ponyfill, { AggregatedError } from './internal/ponyfills/Promise.any.js';
|
|
5
|
-
|
|
6
|
-
export const anyPPonyfill = curryN(1, ponyfill);
|
|
7
|
-
export { AggregatedError };
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Returns a promise that is fulfilled by the first given promise to be fulfilled,
|
|
11
|
-
* or rejected with an array of rejection reasons if all of the given promises are rejected.
|
|
12
|
-
*
|
|
13
|
-
* @func anyP
|
|
14
|
-
* @memberOf RA
|
|
15
|
-
* @category Function
|
|
16
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.22.0|v2.22.0}
|
|
17
|
-
* @sig [Promise a] -> Promise a
|
|
18
|
-
* @param {Iterable.<*>} iterable An iterable object such as an Array or String
|
|
19
|
-
* @return {Promise} A promise that is fulfilled by the first given promise to be fulfilled, or rejected with an array of rejection reasons if all of the given promises are rejected
|
|
20
|
-
* @see {@link RA.lastP|lastP}
|
|
21
|
-
* @example
|
|
22
|
-
*
|
|
23
|
-
* RA.anyP([
|
|
24
|
-
* Promise.resolve(1),
|
|
25
|
-
* 2,
|
|
26
|
-
* Promise.reject(3),
|
|
27
|
-
* ]); //=> Promise(1)
|
|
28
|
-
*/
|
|
29
|
-
const anyP = isFunction(Promise.any)
|
|
30
|
-
? curryN(1, bind(Promise.any, Promise))
|
|
31
|
-
: anyPPonyfill;
|
|
32
|
-
|
|
33
|
-
export default anyP;
|
package/src/appendFlipped.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { append, flip } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns a new list containing the contents of the given list, followed by the given element.
|
|
5
|
-
* Like {@link http://ramdajs.com/docs/#append|R.append} but with argument order reversed.
|
|
6
|
-
*
|
|
7
|
-
* @func appendFlipped
|
|
8
|
-
* @memberOf RA
|
|
9
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.5.0|v2.5.0}
|
|
10
|
-
* @category List
|
|
11
|
-
* @sig [a] -> a -> [a]
|
|
12
|
-
* @param {Array} list The list of elements to add a new item to
|
|
13
|
-
* @param {*} el The element to add to the end of the new list
|
|
14
|
-
* @return {Array} A new list containing the elements of the old list followed by `el`
|
|
15
|
-
* @see {@link http://ramdajs.com/docs/#append|R.append}
|
|
16
|
-
* @example
|
|
17
|
-
*
|
|
18
|
-
* RA.appendFlipped(['write', 'more'], 'tests'); //=> ['write', 'more', 'tests']
|
|
19
|
-
* RA.appendFlipped([], 'tests'); //=> ['tests']
|
|
20
|
-
* RA.appendFlipped(['write', 'more'], ['tests']); //=> ['write', 'more', ['tests']]
|
|
21
|
-
*/
|
|
22
|
-
const appendFlipped = flip(append);
|
|
23
|
-
|
|
24
|
-
export default appendFlipped;
|
package/src/argsPass.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { useWith, curry, compose } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import list from './list.js';
|
|
4
|
-
import isTruthy from './isTruthy.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Takes a combining predicate and a list of functions and returns a function which will map the
|
|
8
|
-
* arguments it receives to the list of functions and returns the result of passing the values
|
|
9
|
-
* returned from each function to the combining predicate. A combining predicate is a function that
|
|
10
|
-
* combines a list of Boolean values into a single Boolean value, such as `R.any` or `R.all`. It
|
|
11
|
-
* will test each value using `RA.isTruthy`, meaning the functions don't necessarily have to be
|
|
12
|
-
* predicates.
|
|
13
|
-
*
|
|
14
|
-
* The function returned is curried to the number of functions supplied, and if called with more
|
|
15
|
-
* arguments than functions, any remaining arguments are passed in to the combining predicate
|
|
16
|
-
* untouched.
|
|
17
|
-
*
|
|
18
|
-
* @func argsPass
|
|
19
|
-
* @memberOf RA
|
|
20
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.7.0|v2.7.0}
|
|
21
|
-
* @category Logic
|
|
22
|
-
* @sig ((* -> Boolean) -> [*] -> Boolean) -> [(* -> Boolean), ...] -> (*...) -> Boolean
|
|
23
|
-
* @param {Function} combiningPredicate The predicate used to combine the values returned from the
|
|
24
|
-
* list of functions
|
|
25
|
-
* @param {Array} functions List of functions
|
|
26
|
-
* @return {boolean} Returns the combined result of mapping arguments to functions
|
|
27
|
-
* @example
|
|
28
|
-
*
|
|
29
|
-
* RA.argsPass(R.all, [RA.isArray, RA.isBoolean, RA.isString])([], false, 'abc') //=> true
|
|
30
|
-
* RA.argsPass(R.all, [RA.isArray, RA.isBoolean, RA.isString])([], false, 1) //=> false
|
|
31
|
-
* RA.argsPass(R.any, [RA.isArray, RA.isBoolean, RA.isString])({}, 1, 'abc') //=> true
|
|
32
|
-
* RA.argsPass(R.any, [RA.isArray, RA.isBoolean, RA.isString])({}, 1, false) //=> false
|
|
33
|
-
* RA.argsPass(R.none, [RA.isArray, RA.isBoolean, RA.isString])({}, 1, false) //=> true
|
|
34
|
-
* RA.argsPass(R.none, [RA.isArray, RA.isBoolean, RA.isString])({}, 1, 'abc') //=> false
|
|
35
|
-
*/
|
|
36
|
-
const argsPass = curry((combiningPredicate, predicates) =>
|
|
37
|
-
useWith(compose(combiningPredicate(isTruthy), list), predicates)
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
export default argsPass;
|
package/src/async.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { curryN, bind } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import resolveP from './resolveP.js';
|
|
4
|
-
import rejectP from './rejectP.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Takes a generator function and returns an async function.
|
|
8
|
-
* The async function returned is a curried function whose arity matches that of the generator function.
|
|
9
|
-
*
|
|
10
|
-
* Note: This function is handy for environments that does support generators but doesn't support async/await.
|
|
11
|
-
*
|
|
12
|
-
* @func async
|
|
13
|
-
* @memberOf RA
|
|
14
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.16.0|v2.16.0}
|
|
15
|
-
* @category Function
|
|
16
|
-
* @sig Promise c => (a, b, ...) -> a -> b -> ... -> c
|
|
17
|
-
* @param {Function} generatorFn The generator function
|
|
18
|
-
* @return {Function} Curried async function
|
|
19
|
-
* @see {@link https://www.promisejs.org/generators/}
|
|
20
|
-
* @example
|
|
21
|
-
*
|
|
22
|
-
* const asyncFn = RA.async(function* generator(val1, val2) {
|
|
23
|
-
* const a = yield Promise.resolve(val1);
|
|
24
|
-
* const b = yield Promise.resolve(val2);
|
|
25
|
-
*
|
|
26
|
-
* return a + b;
|
|
27
|
-
* });
|
|
28
|
-
*
|
|
29
|
-
* asyncFn(1, 2); //=> Promise(3)
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
|
-
const async = curryN(1, (generatorFn) => {
|
|
33
|
-
function asyncWrapper(...args) {
|
|
34
|
-
const iterator = bind(generatorFn, this)(...args);
|
|
35
|
-
|
|
36
|
-
const handle = (result) => {
|
|
37
|
-
const resolved = resolveP(result.value);
|
|
38
|
-
|
|
39
|
-
return result.done
|
|
40
|
-
? resolved
|
|
41
|
-
: resolved.then(
|
|
42
|
-
(value) => handle(iterator.next(value)),
|
|
43
|
-
(error) => handle(iterator.throw(error))
|
|
44
|
-
);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
try {
|
|
48
|
-
return handle(iterator.next());
|
|
49
|
-
} catch (error) {
|
|
50
|
-
return rejectP(error);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (generatorFn.length > 0) {
|
|
55
|
-
return curryN(generatorFn.length, asyncWrapper);
|
|
56
|
-
}
|
|
57
|
-
return asyncWrapper;
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
export default async;
|
package/src/cata.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { curry } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import isFunction from './isFunction.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* The catamorphism is a way of folding a type into a value.
|
|
7
|
-
*
|
|
8
|
-
* **Either**
|
|
9
|
-
*
|
|
10
|
-
* If the either is right then the right function will be executed with
|
|
11
|
-
* the `right` value and the value of the function returned. Otherwise the left function
|
|
12
|
-
* will be called with the `left` value.
|
|
13
|
-
*
|
|
14
|
-
* **Maybe**
|
|
15
|
-
*
|
|
16
|
-
* If the maybe is Some than the right function will be executed with the `some` value and the value of the function
|
|
17
|
-
* returned. Otherwise the left function with be called without an argument.
|
|
18
|
-
*
|
|
19
|
-
* **Result**
|
|
20
|
-
*
|
|
21
|
-
* If the result is Ok than the right function will be executed with the `Ok` value and the value of the function
|
|
22
|
-
* returned. Otherwise the left function will be called with the `Error` value.
|
|
23
|
-
*
|
|
24
|
-
* **Validation**
|
|
25
|
-
*
|
|
26
|
-
* If the validation is Success than the right function will be executed with the `Success` value and the value of the function
|
|
27
|
-
* returned. Otherwise the left function will be called with the `Failure` value.
|
|
28
|
-
*
|
|
29
|
-
* Supported monadic libraries: {@link https://monet.github.io/monet.js/|monet.js}, {@link https://folktale.origamitower.com/|folktale}, {@link https://github.com/ramda/ramda-fantasy|ramda-fantasy}
|
|
30
|
-
*
|
|
31
|
-
* @func cata
|
|
32
|
-
* @memberOf RA
|
|
33
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/1.4.0|v1.4.0}
|
|
34
|
-
* @category Function
|
|
35
|
-
* @sig (a -> b) -> (a -> c) -> Cata a -> b | c
|
|
36
|
-
* @param {Function} leftFn The left function that consumes the left value
|
|
37
|
-
* @param {Function} rightFn The right function that consumes the right value
|
|
38
|
-
* @param {Cata} catamorphicObj Either, Maybe or any other type with catamorphic capabilities (`cata` or `either` method)
|
|
39
|
-
* @return {*}
|
|
40
|
-
* @see {@link https://monet.github.io/monet.js/#cata|cata explained}
|
|
41
|
-
* @example
|
|
42
|
-
*
|
|
43
|
-
* // Either
|
|
44
|
-
* const eitherR = Either.Right(1);
|
|
45
|
-
* const eitherL = Either.Left(2);
|
|
46
|
-
*
|
|
47
|
-
* RA.cata(identity, identity, eitherR); //=> 1
|
|
48
|
-
* RA.cata(identity, identity, eitherL); //=> 2
|
|
49
|
-
*
|
|
50
|
-
* // Maybe
|
|
51
|
-
* const maybeSome = Maybe.Some(1);
|
|
52
|
-
* const maybeNothing = Maybe.Nothing();
|
|
53
|
-
*
|
|
54
|
-
* RA.cata(identity, identity, maybeSome); //=> 1
|
|
55
|
-
* RA.cata(identity, identity, maybeNothing); //=> undefined
|
|
56
|
-
*/
|
|
57
|
-
const catamorphism = curry((leftFn, rightFn, catamorphicObj) => {
|
|
58
|
-
// folktale support
|
|
59
|
-
if (isFunction(catamorphicObj.matchWith)) {
|
|
60
|
-
return catamorphicObj.matchWith({
|
|
61
|
-
// Result type
|
|
62
|
-
Ok: ({ value }) => rightFn(value),
|
|
63
|
-
Error: ({ value }) => leftFn(value),
|
|
64
|
-
// Maybe type
|
|
65
|
-
Just: ({ value }) => rightFn(value),
|
|
66
|
-
Nothing: () => leftFn(undefined),
|
|
67
|
-
// Validation type
|
|
68
|
-
Success: ({ value }) => rightFn(value),
|
|
69
|
-
Failure: ({ value }) => leftFn(value),
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (isFunction(catamorphicObj.cata)) {
|
|
74
|
-
return catamorphicObj.cata(leftFn, rightFn);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (isFunction(catamorphicObj.getOrElse)) {
|
|
78
|
-
const elseValue = `RA.cata${Math.random()}`;
|
|
79
|
-
const value = catamorphicObj.getOrElse(elseValue);
|
|
80
|
-
return value === elseValue ? leftFn() : rightFn(value);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return catamorphicObj.either(leftFn, rightFn);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
export default catamorphism;
|
package/src/catchP.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { invoker } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Composable shortcut for `Promise.catch`.
|
|
5
|
-
* The catchP function returns a Promise. It takes two arguments: a callback function for the failure of the Promise
|
|
6
|
-
* and the promise instance itself.
|
|
7
|
-
*
|
|
8
|
-
* @func catchP
|
|
9
|
-
* @memberOf RA
|
|
10
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.29.0|v2.29.0}
|
|
11
|
-
* @category Function
|
|
12
|
-
* @sig (a -> Promise b | b) -> Promise b
|
|
13
|
-
* @param {Function} onRejected A Function called if the Promise is rejected. This function has one argument, the rejection reason.
|
|
14
|
-
* @param {Promise} promise Any Promise
|
|
15
|
-
* @return {Promise} Returns a Promise with dealt rejected cases
|
|
16
|
-
* @see {@link RA.thenP|thenP}, {@link RA.resolveP|resolveP}, {@link RA.rejectP|rejectP}, {@link RA.allP|allP}
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
*
|
|
20
|
-
* RA.catchP(() => 'b', Promise.resolve('a')); //=> Promise('a')
|
|
21
|
-
* RA.catchP(() => 'b', Promise.reject('a')); //=> Promise('b')
|
|
22
|
-
*/
|
|
23
|
-
const catchP = invoker(1, 'catch');
|
|
24
|
-
|
|
25
|
-
export default catchP;
|
package/src/ceil.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { bind, curryN } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns the smallest integer greater than or equal to a given number.
|
|
5
|
-
*
|
|
6
|
-
* Note: ceil(null) returns integer 0 and does not give a NaN error.
|
|
7
|
-
*
|
|
8
|
-
* @func ceil
|
|
9
|
-
* @memberOf RA
|
|
10
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.15.0|v2.15.0}
|
|
11
|
-
* @category Math
|
|
12
|
-
* @sig Number -> Number
|
|
13
|
-
* @param {number} number The number to ceil
|
|
14
|
-
* @return {number} The smallest integer greater than or equal to the given number
|
|
15
|
-
* @example
|
|
16
|
-
*
|
|
17
|
-
* RA.ceil(.95); //=> 1
|
|
18
|
-
* RA.ceil(4); //=> 4
|
|
19
|
-
* RA.ceil(7.004); //=> 8
|
|
20
|
-
* RA.ceil(-0.95); //=> -0
|
|
21
|
-
* RA.ceil(-4); //=> -4
|
|
22
|
-
* RA.ceil(-7.004); //=> -7
|
|
23
|
-
* RA.ceil(null); //=> 0
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
const ceil = curryN(1, bind(Math.ceil, Math));
|
|
27
|
-
|
|
28
|
-
export default ceil;
|
package/src/compact.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { reject } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import isFalsy from './isFalsy.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Creates an array with all falsy values removed.
|
|
7
|
-
* The values false, null, 0, "", undefined, and NaN are falsy.
|
|
8
|
-
*
|
|
9
|
-
* @func compact
|
|
10
|
-
* @memberOf RA
|
|
11
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.5.0|v2.5.0}
|
|
12
|
-
* @category List
|
|
13
|
-
* @sig Filterable f => f a -> f a
|
|
14
|
-
* @param {Array} list The array to compact
|
|
15
|
-
* @return {Array} Returns the new array of filtered values
|
|
16
|
-
* @see {@link RA.isFalsy|isFalsy}
|
|
17
|
-
* @example
|
|
18
|
-
*
|
|
19
|
-
* RA.compact([0, 1, false, 2, '', 3]); //=> [1, 2, 3]
|
|
20
|
-
*/
|
|
21
|
-
const compact = reject(isFalsy);
|
|
22
|
-
|
|
23
|
-
export default compact;
|
package/src/concatAll.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { concat, identical, identity, pipe, reduce, when } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import stubUndefined from './stubUndefined.js';
|
|
4
|
-
|
|
5
|
-
const leftIdentitySemigroup = { concat: identity };
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Returns the result of concatenating the given lists or strings.
|
|
9
|
-
* Note: RA.concatAll expects all elements to be of the same type. It will throw an error if you concat an Array with a non-Array value.
|
|
10
|
-
* Dispatches to the concat method of the preceding element, if present. Can also concatenate multiple elements of a [fantasy-land compatible semigroup](https://github.com/fantasyland/fantasy-land#semigroup).
|
|
11
|
-
* Returns undefined if empty array was passed.
|
|
12
|
-
*
|
|
13
|
-
* @func concatAll
|
|
14
|
-
* @memberOf RA
|
|
15
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.6.0|v2.6.0}
|
|
16
|
-
* @category List
|
|
17
|
-
* @sig [[a]] -> [a] | Undefined
|
|
18
|
-
* @sig [String] -> String | Undefined
|
|
19
|
-
* @sig Semigroup s => Foldable s f => f -> s | Undefined
|
|
20
|
-
* @param {Array.<Array|string>} list List containing elements that will be concatenated
|
|
21
|
-
* @return {Array|string|undefined} Concatenated elements
|
|
22
|
-
* @see {@link http://ramdajs.com/docs/#concat|R.concat}, {@link RA.concatRight|concatRight}, {@link http://ramdajs.com/docs/#unnest|R.unnest}, {@link http://ramdajs.com/docs/#join|R.join}
|
|
23
|
-
* @example
|
|
24
|
-
*
|
|
25
|
-
* concatAll([[1], [2], [3]]); //=> [1, 2, 3]
|
|
26
|
-
* concatAll(['1', '2', '3']); //=> '123'
|
|
27
|
-
* concatAll([]); //=> undefined
|
|
28
|
-
* concatAll(null); //=> undefined
|
|
29
|
-
*/
|
|
30
|
-
const concatAll = pipe(
|
|
31
|
-
reduce(concat, leftIdentitySemigroup),
|
|
32
|
-
when(identical(leftIdentitySemigroup), stubUndefined)
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
export default concatAll;
|