ramda-adjunct 5.0.0 → 5.1.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/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/RA.node.js +10440 -452
- package/dist/RA.node.min.js +1 -1
- package/dist/RA.web.js +10440 -452
- package/dist/RA.web.min.js +1 -1
- package/dist/RA.web.standalone.js +18646 -447
- package/dist/RA.web.standalone.min.js +1 -1
- package/dist/package.json +1 -0
- package/es/async.js +4 -4
- 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 +5 -5
- 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 +33 -30
- package/types/index.d.ts +0 -5
- 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/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;
|
package/src/concatRight.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { concat, flip } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns the result of concatenating the given lists or strings.
|
|
5
|
-
*
|
|
6
|
-
* Note: R.concat expects both arguments to be of the same type, unlike
|
|
7
|
-
* the native Array.prototype.concat method.
|
|
8
|
-
* It will throw an error if you concat an Array with a non-Array value.
|
|
9
|
-
* Dispatches to the concat method of the second argument, if present.
|
|
10
|
-
*
|
|
11
|
-
* @func concatRight
|
|
12
|
-
* @memberOf RA
|
|
13
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/1.11.0|v1.11.0}
|
|
14
|
-
* @category List
|
|
15
|
-
* @sig [a] -> [a] -> [a]
|
|
16
|
-
* @sig String -> String -> String
|
|
17
|
-
* @param {Array|String} firstList The first list
|
|
18
|
-
* @param {Array|String} secondList The second list
|
|
19
|
-
* @return {Array|String} A list consisting of the elements of `secondList`
|
|
20
|
-
* followed by the elements of `firstList`.
|
|
21
|
-
* @see {@link http://ramdajs.com/docs/#concat|R.concat}
|
|
22
|
-
* @example
|
|
23
|
-
*
|
|
24
|
-
* RA.concatRight('ABC', 'DEF'); //=> 'DEFABC'
|
|
25
|
-
* RA.concatRight([4, 5, 6], [1, 2, 3]); //=> [1, 2, 3, 4, 5, 6]
|
|
26
|
-
* RA.concatRight([], []); //=> []
|
|
27
|
-
*/
|
|
28
|
-
const concatRight = flip(concat);
|
|
29
|
-
|
|
30
|
-
export default concatRight;
|
package/src/copyKeys.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { curryN } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import renameKeys from './renameKeys.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Creates a new object with the own properties of the provided object, and the
|
|
7
|
-
* keys copied according to the keysMap object as `{oldKey: newKey}`.
|
|
8
|
-
* When no key from the keysMap is found, then a shallow clone of an object is returned.
|
|
9
|
-
*
|
|
10
|
-
* Keep in mind that in the case of keys conflict is behaviour undefined and
|
|
11
|
-
* the result may vary between various JS engines!
|
|
12
|
-
*
|
|
13
|
-
* @func copyKeys
|
|
14
|
-
* @memberOf RA
|
|
15
|
-
* @category Object
|
|
16
|
-
* @sig {a: b} -> {a: *} -> {b: *}
|
|
17
|
-
* @param {!Object} keysMap
|
|
18
|
-
* @param {!Object} obj
|
|
19
|
-
* @return {!Object} New object with copied keys
|
|
20
|
-
* @see {@link RA.renameKeys|renameKeys}
|
|
21
|
-
* @example
|
|
22
|
-
*
|
|
23
|
-
* copyKeys({ a: 'b' }, { a: true }); //=> { a: true, b: true }
|
|
24
|
-
* copyKeys({ a: 'b' }, { a: true, b: false }); //=> { a: true, b: true }
|
|
25
|
-
*/
|
|
26
|
-
const copyKeys = curryN(2, (keysMap, obj) => ({
|
|
27
|
-
...obj,
|
|
28
|
-
...renameKeys(keysMap, obj),
|
|
29
|
-
}));
|
|
30
|
-
|
|
31
|
-
export default copyKeys;
|
package/src/curryRight.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { converge, length, identity } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import curryRightN from './curryRightN.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Returns a curried equivalent of the provided function.
|
|
7
|
-
* This function is like curry, except that the provided arguments order is reversed.
|
|
8
|
-
*
|
|
9
|
-
* @func curryRight
|
|
10
|
-
* @memberOf RA
|
|
11
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/1.12.0|v1.12.0}
|
|
12
|
-
* @category Function
|
|
13
|
-
* @sig (* -> a) -> (* -> a)
|
|
14
|
-
* @param {Function} fn The function to curry
|
|
15
|
-
* @return {Function} A new, curried function
|
|
16
|
-
* @see {@link http://ramdajs.com/docs/#curry|R.curry}, {@link RA.curryRightN|curryRightN}
|
|
17
|
-
* @example
|
|
18
|
-
*
|
|
19
|
-
* const concatStrings = (a, b, c) => a + b + c;
|
|
20
|
-
* const concatStringsCurried = RA.curryRight(concatStrings);
|
|
21
|
-
*
|
|
22
|
-
* concatStringCurried('a')('b')('c'); // => 'cba'
|
|
23
|
-
*/
|
|
24
|
-
const curryRight = converge(curryRightN, [length, identity]);
|
|
25
|
-
|
|
26
|
-
export default curryRight;
|
package/src/curryRightN.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { curryN, reverse } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns a curried equivalent of the provided function, with the specified arity.
|
|
5
|
-
* This function is like curryN, except that the provided arguments order is reversed.
|
|
6
|
-
*
|
|
7
|
-
* @func curryRightN
|
|
8
|
-
* @memberOf RA
|
|
9
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/1.12.0|v1.12.0}
|
|
10
|
-
* @category Function
|
|
11
|
-
* @sig Number -> (* -> a) -> (* -> a)
|
|
12
|
-
* @param {number} length The arity for the returned function
|
|
13
|
-
* @param {Function} fn The function to curry
|
|
14
|
-
* @return {Function} A new, curried function
|
|
15
|
-
* @see {@link http://ramdajs.com/docs/#curryN|R.curryN}, {@link RA.curryRight|curryRight}
|
|
16
|
-
* @example
|
|
17
|
-
*
|
|
18
|
-
* const concatStrings = (a, b, c) => a + b + c;
|
|
19
|
-
* const concatStringsCurried = RA.curryRightN(3, concatStrings);
|
|
20
|
-
*
|
|
21
|
-
* concatStringCurried('a')('b')('c'); // => 'cba'
|
|
22
|
-
*/
|
|
23
|
-
const curryRightN = curryN(2, (arity, fn) =>
|
|
24
|
-
curryN(arity, function wrapper(...args) {
|
|
25
|
-
return fn.apply(this, reverse(args));
|
|
26
|
-
})
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
export default curryRightN;
|
package/src/defaultWhen.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { curry } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns the second argument if predicate function returns `true`,
|
|
5
|
-
* otherwise the third argument is returned.
|
|
6
|
-
*
|
|
7
|
-
* @func defaultWhen
|
|
8
|
-
* @memberOf RA
|
|
9
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.2.0|v2.2.0}
|
|
10
|
-
* @category Logic
|
|
11
|
-
* @sig (a -> Boolean) -> b -> a -> a | b
|
|
12
|
-
* @param {!function} predicate The predicate function
|
|
13
|
-
* @param {*} defaultVal The default value
|
|
14
|
-
* @param {*} val `val` will be returned instead of `defaultVal` if predicate returns false
|
|
15
|
-
* @return {*} The `val` if predicate returns `false`, otherwise the default value
|
|
16
|
-
* @see {@link http://ramdajs.com/docs/#defaultTo|R.defaultTo}
|
|
17
|
-
* @example
|
|
18
|
-
*
|
|
19
|
-
* RA.defaultWhen(RA.isNull, 1, null); // => 1
|
|
20
|
-
* RA.defaultWhen(RA.isNull, 1, 2); // => 2
|
|
21
|
-
*/
|
|
22
|
-
const defaultWhen = curry((predicate, defaultVal, val) =>
|
|
23
|
-
predicate(val) ? defaultVal : val
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
export default defaultWhen;
|
package/src/delayP.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { curry, propOr, partial, nth } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import isNonNegative from './isNonNegative.js';
|
|
4
|
-
import isInteger from './isInteger.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Creates a promise which resolves/rejects after the specified milliseconds.
|
|
8
|
-
*
|
|
9
|
-
* @func delayP
|
|
10
|
-
* @memberOf RA
|
|
11
|
-
* @category Function
|
|
12
|
-
* @sig Number -> Promise Undefined
|
|
13
|
-
* @sig {timeout: Number, value: a} -> Promise a
|
|
14
|
-
* @param {number|Object} milliseconds number of milliseconds or options object
|
|
15
|
-
* @return {Promise} A Promise that is resolved/rejected with the given value (if provided) after the specified delay
|
|
16
|
-
* @example
|
|
17
|
-
*
|
|
18
|
-
* RA.delayP(200); //=> Promise(undefined)
|
|
19
|
-
* RA.delayP({ timeout: 1000, value: 'hello world' }); //=> Promise('hello world')
|
|
20
|
-
* RA.delayP.reject(100); //=> Promise(undefined)
|
|
21
|
-
* RA.delayP.reject({ timeout: 100, value: new Error('error') }); //=> Promise(Error('error'))
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
const makeDelay = curry((settleFnPicker, opts) => {
|
|
25
|
-
let timeout;
|
|
26
|
-
let value;
|
|
27
|
-
|
|
28
|
-
if (isInteger(opts) && isNonNegative(opts)) {
|
|
29
|
-
timeout = opts;
|
|
30
|
-
} else {
|
|
31
|
-
timeout = propOr(0, 'timeout', opts);
|
|
32
|
-
value = propOr(value, 'value', opts);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return new Promise((...args) => {
|
|
36
|
-
const settleFn = settleFnPicker(args);
|
|
37
|
-
|
|
38
|
-
setTimeout(partial(settleFn, [value]), timeout);
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
const delayP = makeDelay(nth(0));
|
|
43
|
-
delayP.reject = makeDelay(nth(1));
|
|
44
|
-
|
|
45
|
-
export default delayP;
|
package/src/dispatch.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
sort,
|
|
3
|
-
comparator,
|
|
4
|
-
prop,
|
|
5
|
-
pipe,
|
|
6
|
-
head,
|
|
7
|
-
curryN,
|
|
8
|
-
reduce,
|
|
9
|
-
reduced,
|
|
10
|
-
curry,
|
|
11
|
-
ifElse,
|
|
12
|
-
} from 'ramda';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Can be used as a way to compose multiple invokers together to form polymorphic functions,
|
|
16
|
-
* or functions that exhibit different behaviors based on their argument(s).
|
|
17
|
-
* Consumes dispatching functions and keep trying to invoke each in turn, until a non-nil value is returned.
|
|
18
|
-
*
|
|
19
|
-
* Accepts a list of dispatching functions and returns a new function.
|
|
20
|
-
* When invoked, this new function is applied to some arguments,
|
|
21
|
-
* each dispatching function is applied to those same arguments until one of the
|
|
22
|
-
* dispatching functions returns a non-nil value.
|
|
23
|
-
*
|
|
24
|
-
* @func dispatch
|
|
25
|
-
* @memberOf RA
|
|
26
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.6.0|v2.6.0}
|
|
27
|
-
* @category Function
|
|
28
|
-
* @sig [((a, b, ...) -> x1), ((a, b, ...) -> x2), ...] -> x1 | x2 | ...
|
|
29
|
-
* @param {!Array} functions A list of functions
|
|
30
|
-
* @return {*|undefined} Returns the first not-nil value, or undefined if either an empty list is provided or none of the dispatching functions returns a non-nil value
|
|
31
|
-
* @see {@link RA.isNotNil}
|
|
32
|
-
* @example
|
|
33
|
-
*
|
|
34
|
-
* // returns first non-nil value
|
|
35
|
-
* const stubNil = () => null;
|
|
36
|
-
* const stubUndefined = () => undefined;
|
|
37
|
-
* const addOne = v => v + 1;
|
|
38
|
-
* const addTwo = v => v + 2;
|
|
39
|
-
*
|
|
40
|
-
* RA.dispatch([stubNil, stubUndefined, addOne, addTwo])(1); //=> 2
|
|
41
|
-
*
|
|
42
|
-
* // acts as a switch
|
|
43
|
-
* const fnSwitch = RA.dispatch([
|
|
44
|
-
* R.ifElse(RA.isString, s => `${s}-join`, RA.stubUndefined),
|
|
45
|
-
* R.ifElse(RA.isNumber, n => n + 1, RA.stubUndefined),
|
|
46
|
-
* R.ifElse(RA.isDate, R.T, RA.stubUndefined),
|
|
47
|
-
* ]);
|
|
48
|
-
* fnSwitch(1); //=> 2
|
|
49
|
-
*/
|
|
50
|
-
import isNotNil from './isNotNil.js';
|
|
51
|
-
import isNonEmptyArray from './isNonEmptyArray.js';
|
|
52
|
-
import stubUndefined from './stubUndefined.js';
|
|
53
|
-
|
|
54
|
-
const byArity = comparator((a, b) => a.length > b.length);
|
|
55
|
-
|
|
56
|
-
const getMaxArity = pipe(sort(byArity), head, prop('length'));
|
|
57
|
-
|
|
58
|
-
const iteratorFn = curry((args, accumulator, fn) => {
|
|
59
|
-
const result = fn(...args);
|
|
60
|
-
|
|
61
|
-
return isNotNil(result) ? reduced(result) : accumulator;
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
const dispatchImpl = (functions) => {
|
|
65
|
-
const arity = getMaxArity(functions);
|
|
66
|
-
|
|
67
|
-
return curryN(arity, (...args) =>
|
|
68
|
-
reduce(iteratorFn(args), undefined, functions)
|
|
69
|
-
);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const dispatch = ifElse(isNonEmptyArray, dispatchImpl, stubUndefined);
|
|
73
|
-
|
|
74
|
-
export default dispatch;
|
package/src/divideNum.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { divide, flip } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Divides two numbers, where the second number is divided by the first number.
|
|
5
|
-
*
|
|
6
|
-
* @func divideNum
|
|
7
|
-
* @memberOf RA
|
|
8
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.22.0|v2.22.0}
|
|
9
|
-
* @category Math
|
|
10
|
-
* @sig Number -> Number -> Number
|
|
11
|
-
* @param {number} divisor the number to divide by
|
|
12
|
-
* @param {number} dividend the number to divide
|
|
13
|
-
* @return {number} A number representing the quotient of dividing the dividend by the divisor
|
|
14
|
-
* @example
|
|
15
|
-
*
|
|
16
|
-
* RA.divideNum(2, 1); //=> 0.5
|
|
17
|
-
*/
|
|
18
|
-
const divideNum = flip(divide);
|
|
19
|
-
|
|
20
|
-
export default divideNum;
|
package/src/dropArgs.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { nAry } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Accepts a function with any arity and returns a function with arity of zero.
|
|
5
|
-
* The returned function ignores any arguments supplied to it.
|
|
6
|
-
*
|
|
7
|
-
* @func dropArgs
|
|
8
|
-
* @memberOf RA
|
|
9
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.10.0|v2.10.0}
|
|
10
|
-
* @category Logic
|
|
11
|
-
* @sig (...a -> b)-> () -> b
|
|
12
|
-
* @param {Function} fn The function with any arity
|
|
13
|
-
* @return {Function} Returns function with arity of zero
|
|
14
|
-
* @see {@link http://ramdajs.com/docs/#nAry|R.nAry}
|
|
15
|
-
* @example
|
|
16
|
-
*
|
|
17
|
-
* const fn = (a = 1, b = 2) => a + b;
|
|
18
|
-
*
|
|
19
|
-
* RA.dropArgs(fn)('ignore1', 'ignore2'); //=> 3
|
|
20
|
-
*/
|
|
21
|
-
const dropArgs = nAry(0);
|
|
22
|
-
|
|
23
|
-
export default dropArgs;
|
package/src/ensureArray.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { when, of } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import isNotArray from './isNotArray.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Returns a singleton array containing the value provided.
|
|
7
|
-
* If value is already an array, it is returned as is.
|
|
8
|
-
*
|
|
9
|
-
* @func ensureArray
|
|
10
|
-
* @memberOf RA
|
|
11
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.6.0|v2.6.0}
|
|
12
|
-
* @category List
|
|
13
|
-
* @sig a | [a] -> [a]
|
|
14
|
-
* @param {*|Array} val the value ensure as Array
|
|
15
|
-
* @return {Array}
|
|
16
|
-
* @see {@link http://ramdajs.com/docs/#of|R.of}
|
|
17
|
-
* @example
|
|
18
|
-
*
|
|
19
|
-
* RA.ensureArray(42); //=> [42]
|
|
20
|
-
* RA.ensureArray([42]); //=> [42]
|
|
21
|
-
*/
|
|
22
|
-
const ensureArray = when(isNotArray, of(Array));
|
|
23
|
-
|
|
24
|
-
export default ensureArray;
|
package/src/escapeRegExp.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { when, replace } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import isString from './isString.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Escapes the RegExp special characters.
|
|
7
|
-
*
|
|
8
|
-
* @func escapeRegExp
|
|
9
|
-
* @memberOf RA
|
|
10
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.21.0|v2.21.0}
|
|
11
|
-
* @category String
|
|
12
|
-
* @sig String -> String
|
|
13
|
-
* @param {string} val the value to escape
|
|
14
|
-
* @return {string}
|
|
15
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Escaping|MDN Regular Expressions Escaping}
|
|
16
|
-
* @example
|
|
17
|
-
*
|
|
18
|
-
* RA.escapeRegExp('[ramda-adjunct](https://github.com/char0n/ramda-adjunct)'); //=> '\[ramda\-adjunct\]\(https://github\.com/char0n/ramda\-adjunct\)'
|
|
19
|
-
*/
|
|
20
|
-
const escapeRegExp = when(isString, replace(/[.*+?^${}()|[\]\\-]/g, '\\$&'));
|
|
21
|
-
|
|
22
|
-
export default escapeRegExp;
|