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/src/spreadPath.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { curryN, converge, mergeRight, dissocPath, pathOr } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Spreads object under property path onto provided object.
|
|
5
|
-
* It's like {@link RA.flattenPath|flattenPath}, but removes object under the property path.
|
|
6
|
-
*
|
|
7
|
-
* @func spreadPath
|
|
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 {!Array.<string|number>} path The property path to spread
|
|
14
|
-
* @param {!Object} obj The provided object
|
|
15
|
-
* @return {!Object} The result of the spread
|
|
16
|
-
* @see {@link RA.spreadProp|spreadProp}, {@link RA.flattenPath|flattenPath}
|
|
17
|
-
* @example
|
|
18
|
-
*
|
|
19
|
-
* RA.spreadPath(
|
|
20
|
-
* ['b1', 'b2'],
|
|
21
|
-
* { a: 1, b1: { b2: { c: 3, d: 4 } } }
|
|
22
|
-
* ); // => { a: 1, c: 3, d: 4, b1: {} };
|
|
23
|
-
*/
|
|
24
|
-
const spreadPath = curryN(2, converge(mergeRight, [dissocPath, pathOr({})]));
|
|
25
|
-
|
|
26
|
-
export default spreadPath;
|
package/src/spreadProp.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { of, curry } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import spreadPath from './spreadPath.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Spreads object under property onto provided object.
|
|
7
|
-
* It's like {@link RA.flattenProp|flattenProp}, but removes object under the property.
|
|
8
|
-
*
|
|
9
|
-
* @func spreadProp
|
|
10
|
-
* @memberOf RA
|
|
11
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/1.19.0|v1.19.0}
|
|
12
|
-
* @category Object
|
|
13
|
-
* @typedef Idx = String | Int
|
|
14
|
-
* @sig Idx -> {k: v} -> {k: v}
|
|
15
|
-
* @param {!string|number} prop The property to spread
|
|
16
|
-
* @param {!Object} obj The provided object
|
|
17
|
-
* @return {!Object} The result of the spread
|
|
18
|
-
* @see {@link RA.spreadPath|spreadPath}, {@link RA.flattenProp|flattenProp}
|
|
19
|
-
* @example
|
|
20
|
-
*
|
|
21
|
-
* RA.spreadProp('b', { a: 1, b: { c: 3, d: 4 } }); // => { a: 1, c: 3, d: 4 };
|
|
22
|
-
*/
|
|
23
|
-
const spreadProp = curry((prop, obj) => spreadPath(of(Array, prop), obj));
|
|
24
|
-
|
|
25
|
-
export default spreadProp;
|
package/src/stubArray.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A function that returns new empty array on every call.
|
|
3
|
-
*
|
|
4
|
-
* @func stubArray
|
|
5
|
-
* @memberOf RA
|
|
6
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.1.0|v2.1.0}
|
|
7
|
-
* @category Function
|
|
8
|
-
* @sig ... -> Array
|
|
9
|
-
* @return {Array} New empty array
|
|
10
|
-
* @example
|
|
11
|
-
*
|
|
12
|
-
* RA.stubArray(); //=> []
|
|
13
|
-
* RA.stubArray(1, 2, 3); //=> []
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
const stubArray = () => [];
|
|
17
|
-
|
|
18
|
-
export default stubArray;
|
package/src/stubNull.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { always } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A function that returns `null`.
|
|
5
|
-
*
|
|
6
|
-
* @func stubNull
|
|
7
|
-
* @memberOf RA
|
|
8
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/1.6.0|v1.6.0}
|
|
9
|
-
* @category Function
|
|
10
|
-
* @sig ... -> null
|
|
11
|
-
* @return {null}
|
|
12
|
-
* @example
|
|
13
|
-
*
|
|
14
|
-
* RA.stubNull(); //=> null
|
|
15
|
-
* RA.stubNull(1, 2, 3); //=> null
|
|
16
|
-
*/
|
|
17
|
-
const stubNull = always(null);
|
|
18
|
-
|
|
19
|
-
export default stubNull;
|
package/src/stubObj.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This function returns a new empty object.
|
|
3
|
-
*
|
|
4
|
-
* @func stubObj
|
|
5
|
-
* @memberOf RA
|
|
6
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.1.0|v2.1.0}
|
|
7
|
-
* @category Function
|
|
8
|
-
* @sig ... -> Object
|
|
9
|
-
* @aliases stubObject
|
|
10
|
-
* @return {Object} Returns the new empty object.
|
|
11
|
-
* @example
|
|
12
|
-
*
|
|
13
|
-
* RA.stubObj(); //=> {}
|
|
14
|
-
* RA.stubObj(1, 2, 3); //=> {}
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const stubObj = () => ({});
|
|
18
|
-
|
|
19
|
-
export default stubObj;
|
package/src/stubString.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { always } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A function that returns empty string.
|
|
5
|
-
*
|
|
6
|
-
* @func stubString
|
|
7
|
-
* @memberOf RA
|
|
8
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.1.0|v2.1.0}
|
|
9
|
-
* @category Function
|
|
10
|
-
* @sig ... -> String
|
|
11
|
-
* @return {string} The empty string
|
|
12
|
-
* @example
|
|
13
|
-
*
|
|
14
|
-
* RA.stubString(); //=> ''
|
|
15
|
-
* RA.stubString(1, 2, 3); //=> ''
|
|
16
|
-
*/
|
|
17
|
-
const stubString = always('');
|
|
18
|
-
|
|
19
|
-
export default stubString;
|
package/src/stubUndefined.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { always } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A function that returns `undefined`.
|
|
5
|
-
*
|
|
6
|
-
* @func stubUndefined
|
|
7
|
-
* @memberOf RA
|
|
8
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/1.0.0|v1.0.0}
|
|
9
|
-
* @category Function
|
|
10
|
-
* @sig ... -> undefined
|
|
11
|
-
* @return {undefined}
|
|
12
|
-
* @example
|
|
13
|
-
*
|
|
14
|
-
* RA.stubUndefined(); //=> undefined
|
|
15
|
-
* RA.stubUndefined(1, 2, 3); //=> undefined
|
|
16
|
-
*/
|
|
17
|
-
const stubUndefined = always(void 0); // eslint-disable-line no-void
|
|
18
|
-
|
|
19
|
-
export default stubUndefined;
|
package/src/subtractNum.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { flip, subtract } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Subtracts its first argument from its second argument.
|
|
5
|
-
*
|
|
6
|
-
* @func subtractNum
|
|
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} subtrahend the number to subtract
|
|
12
|
-
* @param {number} minuend the number to subtract from
|
|
13
|
-
* @return {number} A number representing the difference of subtracting the subtrahend from the minuend
|
|
14
|
-
* @example
|
|
15
|
-
*
|
|
16
|
-
* RA.subtractNum(3, 5); //=> 2
|
|
17
|
-
*/
|
|
18
|
-
const subtractNum = flip(subtract);
|
|
19
|
-
|
|
20
|
-
export default subtractNum;
|
package/src/thenCatchP.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { invoker } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Composable shortcut for `Promise.then` that allows for success and failure callbacks.
|
|
5
|
-
* The thenCatchP function returns a Promise. It takes three arguments: a callback function for the success of the Promise,
|
|
6
|
-
* a callback function for the failure of the Promise, and the promise instance itself.
|
|
7
|
-
*
|
|
8
|
-
* @func thenCatchP
|
|
9
|
-
* @memberOf RA
|
|
10
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.27.0|v2.27.0}
|
|
11
|
-
* @category Function
|
|
12
|
-
* @sig (a -> b) -> (c -> d) -> Promise a -> Promise b | d
|
|
13
|
-
* @param {Function} onFulfilled A Function called if the Promise is fulfilled. This function has one argument, the fulfillment value
|
|
14
|
-
* @param {Function} onRejected A Function called if the Promise is rejected. This function has one argument, the error
|
|
15
|
-
* @param {Promise} promise Any Promise or Thenable object
|
|
16
|
-
* @return {Promise}
|
|
17
|
-
* @see {@link RA.resolveP|resolveP}, {@link RA.rejectP|rejectP}, {@link RA.allP|allP}
|
|
18
|
-
* @example
|
|
19
|
-
*
|
|
20
|
-
* const promise = Promise.resolve(1);
|
|
21
|
-
* const add1 = x => x + 1;
|
|
22
|
-
*
|
|
23
|
-
* RA.thenCatchP(add1, console.error, promise); // => Promise(2)
|
|
24
|
-
*/
|
|
25
|
-
export const thenCatchP = invoker(2, 'then');
|
|
26
|
-
|
|
27
|
-
export default thenCatchP;
|
package/src/toArray.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { ifElse, values, curryN } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import isIterable from './isIterable.js';
|
|
4
|
-
import isFunction from './isFunction.js';
|
|
5
|
-
import ponyfill from './internal/ponyfills/Array.from.js';
|
|
6
|
-
|
|
7
|
-
export const fromPonyfill = curryN(1, ponyfill);
|
|
8
|
-
|
|
9
|
-
const fromArray = isFunction(Array.from) ? curryN(1, Array.from) : fromPonyfill;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Converts value to an array.
|
|
13
|
-
*
|
|
14
|
-
* @func toArray
|
|
15
|
-
* @memberOf RA
|
|
16
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.22.0|v2.22.0}
|
|
17
|
-
* @category List
|
|
18
|
-
* @sig * -> [a]
|
|
19
|
-
* @param {*} val The value to convert
|
|
20
|
-
* @return {Array}
|
|
21
|
-
* @example
|
|
22
|
-
*
|
|
23
|
-
* RA.toArray([1, 2]); //=> [1, 2]
|
|
24
|
-
* RA.toArray({'foo': 1, 'bar': 2}); //=> [1, 2]
|
|
25
|
-
* RA.toArray('abc'); //=> ['a', 'b', 'c']
|
|
26
|
-
* RA.toArray(1); //=> []
|
|
27
|
-
* RA.toArray(null); //=> []
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
const toArray = ifElse(isIterable, fromArray, values);
|
|
31
|
-
|
|
32
|
-
export default toArray;
|
package/src/toInteger32.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { curryN } from 'ramda';
|
|
2
|
-
/**
|
|
3
|
-
* Converts double-precision 64-bit binary format IEEE 754 to signed 32 bit integer number.
|
|
4
|
-
*
|
|
5
|
-
* @func toInteger32
|
|
6
|
-
* @aliases toInt32
|
|
7
|
-
* @memberOf RA
|
|
8
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.28.0|v2.28.0}
|
|
9
|
-
* @category Math
|
|
10
|
-
* @sig Number -> Number
|
|
11
|
-
* @param {number} number A number
|
|
12
|
-
* @return {number} A signed 32-bit integer number
|
|
13
|
-
* @see {@link RA.toUInteger32|toUInteger32}, {@link http://speakingjs.com/es5/ch11.html#integers_via_bitwise_operators}
|
|
14
|
-
* @example
|
|
15
|
-
*
|
|
16
|
-
* RA.toInteger32(2 ** 35); // => 0
|
|
17
|
-
* RA.toInteger32(2 ** 30); // => 1073741824
|
|
18
|
-
*/
|
|
19
|
-
// eslint-disable-next-line no-bitwise
|
|
20
|
-
const toInteger32 = curryN(1, (val) => val >> 0);
|
|
21
|
-
|
|
22
|
-
export default toInteger32;
|
package/src/toNumber.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { ifElse, always } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import isCoercible from './internal/isCoercible.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Converts value to a number.
|
|
7
|
-
*
|
|
8
|
-
* @func toNumber
|
|
9
|
-
* @memberOf RA
|
|
10
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.36.0|v2.36.0}
|
|
11
|
-
* @category Type
|
|
12
|
-
* @param {*} val The value to convert
|
|
13
|
-
* @return {Number}
|
|
14
|
-
* @example
|
|
15
|
-
*
|
|
16
|
-
* RA.toNumber(3.2); //=> 3.2
|
|
17
|
-
* RA.toNumber(Number.MIN_VALUE); //=> 5e-324
|
|
18
|
-
* RA.toNumber(Infinity); //=> Infinity
|
|
19
|
-
* RA.toNumber('3.2'); //=> 3.2
|
|
20
|
-
* RA.toNumber(Symbol('3.2')); //=> NaN
|
|
21
|
-
*/
|
|
22
|
-
const toNumber = ifElse(isCoercible, Number, always(NaN));
|
|
23
|
-
|
|
24
|
-
export default toNumber;
|
package/src/toUinteger32.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { curryN } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Converts double-precision 64-bit binary format IEEE 754 to unsigned 32 bit integer number.
|
|
5
|
-
*
|
|
6
|
-
* @func toUinteger32
|
|
7
|
-
* @aliases toUint32
|
|
8
|
-
* @memberOf RA
|
|
9
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.28.0|v2.28.0}
|
|
10
|
-
* @category Math
|
|
11
|
-
* @sig Number -> Number
|
|
12
|
-
* @param {number} val Value to be converted.
|
|
13
|
-
* @return {number}
|
|
14
|
-
* @see {@link RA.toInteger32|toInteger32}, {@link http://speakingjs.com/es5/ch11.html#integers_via_bitwise_operators}
|
|
15
|
-
* @example
|
|
16
|
-
*
|
|
17
|
-
* RA.toUinteger32(1.5); //=> 1
|
|
18
|
-
* RA.toInteger32(2 ** 35); // => 0
|
|
19
|
-
* RA.toInteger32(2 ** 31); // => 2147483648
|
|
20
|
-
* RA.toInteger32(2 ** 30); // => 1073741824
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
// eslint-disable-next-line no-bitwise
|
|
24
|
-
const toUinteger32 = curryN(1, (val) => val >>> 0);
|
|
25
|
-
|
|
26
|
-
export default toUinteger32;
|
package/src/trimCharsEnd.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { curry, dropLastWhile, join, pipe, split } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import included from './included.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Removes specified characters from the end of a string.
|
|
7
|
-
*
|
|
8
|
-
* @func trimCharsEnd
|
|
9
|
-
* @memberOf RA
|
|
10
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.25.0|v2.25.0}
|
|
11
|
-
* @category String
|
|
12
|
-
* @sig String -> String
|
|
13
|
-
* @param {string} chars The characters to trim
|
|
14
|
-
* @param {string} value The string to trim
|
|
15
|
-
* @return {string} Returns the trimmed string.
|
|
16
|
-
* @example
|
|
17
|
-
*
|
|
18
|
-
* RA.trimCharsEnd('_-', '-_-abc-_-'); //=> '-_-abc'
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
const trimCharsEnd = curry((chars, value) =>
|
|
22
|
-
pipe(split(''), dropLastWhile(included(chars)), join(''))(value)
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
export default trimCharsEnd;
|
package/src/trimCharsStart.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { curry, dropWhile, join, pipe, split } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import included from './included.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Removes specified characters from the beginning of a string.
|
|
7
|
-
*
|
|
8
|
-
* @func trimCharsStart
|
|
9
|
-
* @memberOf RA
|
|
10
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.24.0|v2.24.0}
|
|
11
|
-
* @category String
|
|
12
|
-
* @sig String -> String
|
|
13
|
-
* @param {string} chars The characters to trim
|
|
14
|
-
* @param {string} value The string to trim
|
|
15
|
-
* @return {string} Returns the trimmed string.
|
|
16
|
-
* @example
|
|
17
|
-
*
|
|
18
|
-
* RA.trimCharsStart('_-', '-_-abc-_-'); //=> 'abc-_-'
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
const trimCharsStart = curry((chars, value) =>
|
|
22
|
-
pipe(split(''), dropWhile(included(chars)), join(''))(value)
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
export default trimCharsStart;
|
package/src/trimEnd.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { invoker } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import ponyfill from './internal/ponyfills/String.trimEnd.js';
|
|
4
|
-
import isFunction from './isFunction.js';
|
|
5
|
-
|
|
6
|
-
export const trimEndPonyfill = ponyfill;
|
|
7
|
-
|
|
8
|
-
export const trimEndInvoker = invoker(0, 'trimEnd');
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Removes whitespace from the end of a string.
|
|
12
|
-
*
|
|
13
|
-
* @func trimEnd
|
|
14
|
-
* @memberOf RA
|
|
15
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.22.0|v2.22.0}
|
|
16
|
-
* @category String
|
|
17
|
-
* @sig String -> String
|
|
18
|
-
* @param {string} value String value to have the whitespace removed from the end
|
|
19
|
-
* @return {string} A new string representing the calling string stripped of whitespace from its end (right end).
|
|
20
|
-
* @see {@link RA.trimEnd|trimEnd}
|
|
21
|
-
* @example
|
|
22
|
-
*
|
|
23
|
-
* RA.trimEnd('abc '); //=> 'abc'
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
const trimEnd = isFunction(String.prototype.trimEnd)
|
|
27
|
-
? trimEndInvoker
|
|
28
|
-
: trimEndPonyfill;
|
|
29
|
-
|
|
30
|
-
export default trimEnd;
|
package/src/trimStart.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { invoker } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import ponyfill from './internal/ponyfills/String.trimStart.js';
|
|
4
|
-
import isFunction from './isFunction.js';
|
|
5
|
-
|
|
6
|
-
export const trimStartPonyfill = ponyfill;
|
|
7
|
-
|
|
8
|
-
export const trimStartInvoker = invoker(0, 'trimStart');
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Removes whitespace from the beginning of a string.
|
|
12
|
-
*
|
|
13
|
-
* @func trimStart
|
|
14
|
-
* @memberOf RA
|
|
15
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.22.0|v2.22.0}
|
|
16
|
-
* @category String
|
|
17
|
-
* @sig String -> String
|
|
18
|
-
* @param {string} value String value to have the whitespace removed from the beginning
|
|
19
|
-
* @return {string} A new string representing the calling string stripped of whitespace from its beginning (left end).
|
|
20
|
-
* @example
|
|
21
|
-
*
|
|
22
|
-
* RA.trimStart(' abc'); //=> 'abc'
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
const trimStart = isFunction(String.prototype.trimStart)
|
|
26
|
-
? trimStartInvoker
|
|
27
|
-
: trimStartPonyfill;
|
|
28
|
-
|
|
29
|
-
export default trimStart;
|
package/src/trunc.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { bind, curryN } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import ponyfill from './internal/ponyfills/Math.trunc.js';
|
|
4
|
-
import isFunction from './isFunction.js';
|
|
5
|
-
|
|
6
|
-
export const truncPonyfill = curryN(1, ponyfill);
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Returns the integer part of a number by removing any fractional digits.
|
|
10
|
-
*
|
|
11
|
-
* @func trunc
|
|
12
|
-
* @memberOf RA
|
|
13
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.15.0|v2.15.0}
|
|
14
|
-
* @category Math
|
|
15
|
-
* @sig Number | String -> Number
|
|
16
|
-
* @param {number|string} number The number to trunc
|
|
17
|
-
* @return {number} The integer part of the given number
|
|
18
|
-
* @example
|
|
19
|
-
*
|
|
20
|
-
* RA.trunc(13.37); //=> 13
|
|
21
|
-
* RA.trunc(42.84); //=> 42
|
|
22
|
-
* RA.trunc(0.123); //=> 0
|
|
23
|
-
* RA.trunc(-0.123); //=> -0
|
|
24
|
-
* RA.trunc('-1.123'); //=> -1
|
|
25
|
-
* RA.trunc(NaN); //=> NaN
|
|
26
|
-
* RA.trunc('foo'); //=> NaN
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
const trunc = isFunction(Math.trunc)
|
|
30
|
-
? curryN(1, bind(Math.trunc, Math))
|
|
31
|
-
: truncPonyfill;
|
|
32
|
-
|
|
33
|
-
export default trunc;
|
package/src/unzipObjWith.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
apply,
|
|
3
|
-
curryN,
|
|
4
|
-
flip,
|
|
5
|
-
map,
|
|
6
|
-
pipe,
|
|
7
|
-
toPairs,
|
|
8
|
-
transpose,
|
|
9
|
-
when,
|
|
10
|
-
} from 'ramda';
|
|
11
|
-
|
|
12
|
-
import lengthEq from './lengthEq.js';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Creates a new list out of the supplied object by applying the function to each key/value pairing.
|
|
16
|
-
*
|
|
17
|
-
* @func unzipObjWith
|
|
18
|
-
* @memberOf RA
|
|
19
|
-
* @category Object
|
|
20
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.22.0|v2.22.0}
|
|
21
|
-
* @sig (v, k) => [k, v] -> { k: v } -> [[k], [v]]
|
|
22
|
-
* @param {Function} fn The function to transform each value-key pair
|
|
23
|
-
* @param {Object} obj Object to unzip
|
|
24
|
-
* @return {Array} A pair of tw lists: a list of keys and a list of values
|
|
25
|
-
* @see {@link https://ramdajs.com/docs/#zipObj|zipObj}, {@link RA.zipObjWith|zipObjWith}
|
|
26
|
-
* @example
|
|
27
|
-
*
|
|
28
|
-
* RA.unzipObjWith((v, k) => [`new${k.toUpperCase()}`, 2 * v], { a: 1, b: 2, c: 3 });
|
|
29
|
-
* //=> [['newA', 'newB', 'newC'], [2, 4, 6]]
|
|
30
|
-
*/
|
|
31
|
-
const unzipObjWith = curryN(2, (fn, obj) =>
|
|
32
|
-
pipe(
|
|
33
|
-
toPairs,
|
|
34
|
-
map(pipe(flip, apply)(fn)),
|
|
35
|
-
transpose,
|
|
36
|
-
when(lengthEq(0), () => [[], []])
|
|
37
|
-
)(obj)
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
export default unzipObjWith;
|
package/src/viewOr.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { view, defaultTo, curryN } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns a "view" of the given data structure, determined by the given lens.
|
|
5
|
-
* The lens's focus determines which portion of the data structure is visible.
|
|
6
|
-
* Returns the defaultValue if "view" is null, undefined or NaN; otherwise the "view" is returned.
|
|
7
|
-
*
|
|
8
|
-
* @func viewOr
|
|
9
|
-
* @memberOf RA
|
|
10
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/1.13.0|1.13.0}
|
|
11
|
-
* @category Object
|
|
12
|
-
* @typedef Lens s b = Functor f => (b -> f b) -> s -> f s
|
|
13
|
-
* @sig a -> Lens s b -> s -> b | a
|
|
14
|
-
* @see {@link http://ramdajs.com/docs/#view|R.view}
|
|
15
|
-
* @param {*} defaultValue The default value
|
|
16
|
-
* @param {Function} lens Van Laarhoven lens
|
|
17
|
-
* @param {*} data The data structure
|
|
18
|
-
* @returns {*} "view" or defaultValue
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
*
|
|
22
|
-
* RA.viewOr('N/A', R.lensProp('x'), {}); // => 'N/A'
|
|
23
|
-
* RA.viewOr('N/A', R.lensProp('x'), { x: 1 }); // => 1
|
|
24
|
-
* RA.viewOr('some', R.lensProp('y'), { y: null }); // => 'some'
|
|
25
|
-
* RA.viewOr('some', R.lensProp('y'), { y: false }); // => false
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
const viewOr = curryN(3, (defaultValue, lens, data) =>
|
|
29
|
-
defaultTo(defaultValue, view(lens, data))
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
export default viewOr;
|
package/src/weave.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { curryN } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Weaves a configuration into function returning the runnable monad like `Reader` or `Free`.
|
|
5
|
-
* This allows us to pre-bind the configuration in advance and use the weaved function
|
|
6
|
-
* without need to explicitly pass the configuration on every call.
|
|
7
|
-
*
|
|
8
|
-
* @func weave
|
|
9
|
-
* @memberOf RA
|
|
10
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/1.7.0|v1.7.0}
|
|
11
|
-
* @category Function
|
|
12
|
-
* @sig (*... -> *) -> * -> (*... -> *)
|
|
13
|
-
* @param {Function} fn The function to weave
|
|
14
|
-
* @param {*} config The configuration to weave into fn
|
|
15
|
-
* @return {Function} Auto-curried weaved function
|
|
16
|
-
* @example
|
|
17
|
-
*
|
|
18
|
-
* const { Reader: reader } = require('monet');
|
|
19
|
-
*
|
|
20
|
-
* const log = value => reader(
|
|
21
|
-
* config => config.log(value)
|
|
22
|
-
* );
|
|
23
|
-
*
|
|
24
|
-
* // no weaving
|
|
25
|
-
* log('test').run(console); //=> prints 'test'
|
|
26
|
-
*
|
|
27
|
-
* // weaving
|
|
28
|
-
* const wlog = RA.weave(log, console);
|
|
29
|
-
* wlog('test'); //=> prints 'test'
|
|
30
|
-
*/
|
|
31
|
-
const weave = curryN(2, (fn, config) =>
|
|
32
|
-
curryN(fn.length, (...args) => fn(...args).run(config))
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
export default weave;
|
package/src/weaveLazy.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { curryN } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Weaves a configuration into function returning the runnable monad like `Reader` or `Free`.
|
|
5
|
-
* This allows us to pre-bind the configuration in advance and use the weaved function
|
|
6
|
-
* without need to explicitly pass the configuration on every call.
|
|
7
|
-
*
|
|
8
|
-
* @func weaveLazy
|
|
9
|
-
* @memberOf RA
|
|
10
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/1.10.0|v1.10.0}
|
|
11
|
-
* @category Function
|
|
12
|
-
* @sig (*... -> *) -> (* -> *) -> (*... -> *)
|
|
13
|
-
* @param {Function} fn The function to weave
|
|
14
|
-
* @param {Function} configAccessor The function that returns the configuration object
|
|
15
|
-
* @return {Function} Auto-curried weaved function
|
|
16
|
-
* @example
|
|
17
|
-
*
|
|
18
|
-
* const { Reader: reader } = require('monet');
|
|
19
|
-
*
|
|
20
|
-
* const log = value => reader(
|
|
21
|
-
* config => config.log(value)
|
|
22
|
-
* );
|
|
23
|
-
*
|
|
24
|
-
* const consoleAccessor = R.always(console);
|
|
25
|
-
*
|
|
26
|
-
* // no weaving
|
|
27
|
-
* log('test').run(console); //=> prints 'test'
|
|
28
|
-
*
|
|
29
|
-
* // weaving
|
|
30
|
-
* const wlog = RA.weaveLazy(log, consoleAccessor);
|
|
31
|
-
* wlog('test'); //=> prints 'test'
|
|
32
|
-
*/
|
|
33
|
-
const weaveLazy = curryN(2, (fn, configAccessor) =>
|
|
34
|
-
curryN(fn.length, (...args) => fn(...args).run(configAccessor()))
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
export default weaveLazy;
|
package/src/zipObjWith.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { apply, curryN, fromPairs, map, pipe, zip } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Creates a new object out of a list of keys and a list of values by applying the function
|
|
5
|
-
* to each equally-positioned pair in the lists.
|
|
6
|
-
* Key/value pairing is truncated to the length of the shorter of the two lists.
|
|
7
|
-
*
|
|
8
|
-
* @func zipObjWith
|
|
9
|
-
* @memberOf RA
|
|
10
|
-
* @category Object
|
|
11
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.22.0|v2.22.0}
|
|
12
|
-
* @sig (b, a) -> [k, v] -> [a] -> [b] -> { k: v }
|
|
13
|
-
* @param {Function} fn The function to transform each value-key pair
|
|
14
|
-
* @param {Array} keys Array to transform into the properties on the output object
|
|
15
|
-
* @param {Array} values Array to transform into the values on the output object
|
|
16
|
-
* @return {Object} The object made by pairing up and transforming same-indexed elements of `keys` and `values`.
|
|
17
|
-
* @see {@link https://ramdajs.com/docs/#zipObj|zipObj}, {@link RA.unzipObjWith|unzipObjWith}
|
|
18
|
-
* @example
|
|
19
|
-
*
|
|
20
|
-
* RA.zipObjWith((value, key) => [key, `${key}${value + 1}`]), ['a', 'b', 'c'], [1, 2, 3]);
|
|
21
|
-
* // => { a: 'a2', b: 'b3', c: 'c4' }
|
|
22
|
-
*/
|
|
23
|
-
const zipObjWith = curryN(3, (fn, keys, values) =>
|
|
24
|
-
pipe(zip, map(apply(fn)), fromPairs)(values, keys)
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
export default zipObjWith;
|