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/mergeProps.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { curryN, pipe, mergeAll, props } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Functional equivalent of merging object properties with object spread operator.
|
|
5
|
-
*
|
|
6
|
-
* @func mergeProps
|
|
7
|
-
* @memberOf RA
|
|
8
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/1.17.0|v1.17.0}
|
|
9
|
-
* @category Object
|
|
10
|
-
* @sig [k] -> {k: {a}} -> {a}
|
|
11
|
-
* @see {@link RA.mergePaths|mergePaths}
|
|
12
|
-
* @param {!Array} ps The property names to merge
|
|
13
|
-
* @param {!Object} obj The object to query
|
|
14
|
-
* @return {!Object} The object composed of merged properties of obj
|
|
15
|
-
* @example
|
|
16
|
-
*
|
|
17
|
-
* const obj = {
|
|
18
|
-
* foo: { fooInner: 1 },
|
|
19
|
-
* bar: { barInner: 2 }
|
|
20
|
-
* };
|
|
21
|
-
*
|
|
22
|
-
* { ...obj.foo, ...obj.bar }; //=> { fooInner: 1, barInner: 2 }
|
|
23
|
-
* RA.mergeProps(['foo', 'bar'], obj); //=> { fooInner: 1, barInner: 2 }
|
|
24
|
-
*/
|
|
25
|
-
const mergeProps = curryN(2, pipe(props, mergeAll));
|
|
26
|
-
|
|
27
|
-
export default mergeProps;
|
package/src/move.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { compose, curry, insert, nth, remove } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns a new list with the item at the position `fromIdx` moved to the position `toIdx`. If the
|
|
5
|
-
* `toIdx` is out of the `list` range, the item will be placed at the last position of the `list`.
|
|
6
|
-
* When negative indices are provided, the behavior of the move is unspecified.
|
|
7
|
-
*
|
|
8
|
-
* @func move
|
|
9
|
-
* @memberOf RA
|
|
10
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.8.0|v2.8.0}
|
|
11
|
-
* @category List
|
|
12
|
-
* @sig Number -> Number -> [a] -> [a]
|
|
13
|
-
* @param {number} fromIdx The position of item to be moved
|
|
14
|
-
* @param {number} toIdx The position of item after move
|
|
15
|
-
* @param {Array} list The list containing the item to be moved
|
|
16
|
-
* @return {Array}
|
|
17
|
-
* @example
|
|
18
|
-
*
|
|
19
|
-
* const list = ['a', 'b', 'c', 'd', 'e'];
|
|
20
|
-
* RA.move(1, 3, list) //=> ['a', 'c', 'd', 'b', 'e']
|
|
21
|
-
*/
|
|
22
|
-
const move = curry((fromIdx, toIdx, list) =>
|
|
23
|
-
compose(insert(toIdx, nth(fromIdx, list)), remove(fromIdx, 1))(list)
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
export default move;
|
package/src/nand.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { and, complement } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns false if both arguments are truthy; true otherwise.
|
|
5
|
-
*
|
|
6
|
-
* @func nand
|
|
7
|
-
* @memberOf RA
|
|
8
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.19.0|v2.19.0}
|
|
9
|
-
* @category Logic
|
|
10
|
-
* @sig a -> b -> Boolean
|
|
11
|
-
* @param {*} a
|
|
12
|
-
* @param {*} b
|
|
13
|
-
* @return {Boolean} false if both arguments are truesy
|
|
14
|
-
* @example
|
|
15
|
-
*
|
|
16
|
-
* RA.nand(true, true); //=> false
|
|
17
|
-
* RA.nand(false, true); //=> true
|
|
18
|
-
* RA.nand(true, false); //=> true
|
|
19
|
-
* RA.nand(false, false); //=> true
|
|
20
|
-
* RA.nand(1.0, 1.0); //=> false
|
|
21
|
-
* RA.nand(1.0, 0); //=> true
|
|
22
|
-
* RA.nand(0, 1.0); //=> true
|
|
23
|
-
* RA.nand(0, 0); //=> true
|
|
24
|
-
*/
|
|
25
|
-
const nand = complement(and); // eslint-disable-line ramda/complement-simplification
|
|
26
|
-
|
|
27
|
-
export default nand;
|
package/src/neither.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { curry, compose, complement, either } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/* eslint-disable max-len */
|
|
4
|
-
/**
|
|
5
|
-
* A function which calls the two provided functions and returns the complement of `||`ing the
|
|
6
|
-
* results.
|
|
7
|
-
* It returns false if the first function is truth-y and the complement of the second function
|
|
8
|
-
* otherwise. Note that this is short-circuited, meaning that the second function will not be
|
|
9
|
-
* invoked if the first returns a truth-y value. In short it will return true if neither predicate
|
|
10
|
-
* returns true.
|
|
11
|
-
*
|
|
12
|
-
* In addition to functions, `RA.neither` also accepts any fantasy-land compatible
|
|
13
|
-
* applicative functor.
|
|
14
|
-
*
|
|
15
|
-
* @func neither
|
|
16
|
-
* @memberOf RA
|
|
17
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.3.0|v2.3.0}
|
|
18
|
-
* @category Logic
|
|
19
|
-
* @sig (*... -> Boolean) -> (*... -> Boolean) -> (*... -> Boolean)
|
|
20
|
-
* @param {Function} f A predicate
|
|
21
|
-
* @param {Function} g Another predicate
|
|
22
|
-
* @return {Function} Returns a function that applies its arguments to `f` and `g` and returns the complement of `||`ing their outputs together.
|
|
23
|
-
* @see {@link http://ramdajs.com/docs/#either|R.either}, {@link http://ramdajs.com/docs/#or|R.or}
|
|
24
|
-
* @example
|
|
25
|
-
*
|
|
26
|
-
* const gt10 = R.gt(R.__, 10)
|
|
27
|
-
* const even = (x) => x % 2 === 0;
|
|
28
|
-
* const f = RA.neither(gt10, even);
|
|
29
|
-
*
|
|
30
|
-
* f(12); //=> false
|
|
31
|
-
* f(8); //=> false
|
|
32
|
-
* f(11); //=> false
|
|
33
|
-
* f(9); //=> true
|
|
34
|
-
*/
|
|
35
|
-
/* eslint-enable max-len */
|
|
36
|
-
const neither = curry(compose(complement, either));
|
|
37
|
-
|
|
38
|
-
export default neither;
|
package/src/noneP.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { curryN, map, pipe } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import allP from './allP.js';
|
|
4
|
-
import rejectP from './rejectP.js';
|
|
5
|
-
import resolveP from './resolveP.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Returns a Promise that is resolved with an array of reasons when all of the provided Promises reject, or rejected when any Promise is resolved.
|
|
9
|
-
* This pattern is like allP, but fulfillments and rejections are transposed - rejections become the fulfillment values and vice versa.
|
|
10
|
-
*
|
|
11
|
-
* @func noneP
|
|
12
|
-
* @memberOf RA
|
|
13
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.22.0|v2.22.0}
|
|
14
|
-
* @category Function
|
|
15
|
-
* @sig [Promise a] -> Promise [a]
|
|
16
|
-
* @param {Iterable.<*>} iterable An iterable object such as an Array or String
|
|
17
|
-
* @return {Promise} A Promise that is resolved with a list of rejection reasons if all Promises are rejected, or a Promise that is rejected with the fulfillment value of the first Promise that resolves.
|
|
18
|
-
* @see {@link RA.allP|allP}
|
|
19
|
-
* @example
|
|
20
|
-
*
|
|
21
|
-
* RA.noneP([Promise.reject('hello'), Promise.reject('world')]); //=> Promise(['hello', 'world'])
|
|
22
|
-
* RA.noneP([]); //=> Promise([])
|
|
23
|
-
* RA.noneP([Promise.reject(), Promise.resolve('hello world')]); //=> Promise('hello world')
|
|
24
|
-
* RA.noneP([Promise.reject(), 'hello world']); //=> Promise('hello world')
|
|
25
|
-
*/
|
|
26
|
-
const noneP = curryN(
|
|
27
|
-
1,
|
|
28
|
-
pipe(
|
|
29
|
-
map(resolveP),
|
|
30
|
-
map((p) => p.then(rejectP, resolveP)),
|
|
31
|
-
allP
|
|
32
|
-
)
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
export default noneP;
|
package/src/nonePass.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { complement, compose, anyPass, curryN } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Takes a list of predicates and returns a predicate that returns true for a given list of
|
|
5
|
-
* arguments if none of the provided predicates are satisfied by those arguments. It is the
|
|
6
|
-
* complement of Ramda's anyPass.
|
|
7
|
-
*
|
|
8
|
-
* The function returned is a curried function whose arity matches that of the
|
|
9
|
-
* highest-arity predicate.
|
|
10
|
-
*
|
|
11
|
-
* @func nonePass
|
|
12
|
-
* @memberOf RA
|
|
13
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.5.0|v2.5.0}
|
|
14
|
-
* @category Logic
|
|
15
|
-
* @sig [(*... -> Boolean)] -> (*... -> Boolean)
|
|
16
|
-
* @param {Array} predicates An array of predicates to check
|
|
17
|
-
* @return {Function} The combined predicate
|
|
18
|
-
* @see {@link http://ramdajs.com/docs/#anyPass|R.anyPass}
|
|
19
|
-
* @example
|
|
20
|
-
*
|
|
21
|
-
* const gt10 = R.gt(R.__, 10)
|
|
22
|
-
* const even = (x) => x % 2 === 0;
|
|
23
|
-
* const f = RA.nonePass([gt10, even]);
|
|
24
|
-
*
|
|
25
|
-
* f(12); //=> false
|
|
26
|
-
* f(8); //=> false
|
|
27
|
-
* f(11); //=> false
|
|
28
|
-
* f(9); //=> true
|
|
29
|
-
*/
|
|
30
|
-
const nonePass = curryN(1, compose(complement, anyPass));
|
|
31
|
-
|
|
32
|
-
export default nonePass;
|
package/src/noop.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { always } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import stubUndefined from './stubUndefined.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* A function that performs no operations.
|
|
7
|
-
*
|
|
8
|
-
* @func noop
|
|
9
|
-
* @memberOf RA
|
|
10
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/1.0.0|v1.0.0}
|
|
11
|
-
* @category Function
|
|
12
|
-
* @sig ... -> undefined
|
|
13
|
-
* @return {undefined}
|
|
14
|
-
* @example
|
|
15
|
-
*
|
|
16
|
-
* RA.noop(); //=> undefined
|
|
17
|
-
* RA.noop(1, 2, 3); //=> undefined
|
|
18
|
-
*/
|
|
19
|
-
const noop = always(stubUndefined());
|
|
20
|
-
|
|
21
|
-
export default noop;
|
package/src/nor.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { or, complement } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns true if both arguments are falsy; false otherwise.
|
|
5
|
-
*
|
|
6
|
-
* @func nor
|
|
7
|
-
* @memberOf RA
|
|
8
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.20.0|v2.20.0}
|
|
9
|
-
* @category Logic
|
|
10
|
-
* @sig a -> b -> a ⊽ b
|
|
11
|
-
* @param {*} a
|
|
12
|
-
* @param {*} b
|
|
13
|
-
* @return {boolean} true if both arguments are falsy
|
|
14
|
-
* @see {@link RA.neither|neither}
|
|
15
|
-
* @example
|
|
16
|
-
*
|
|
17
|
-
* RA.nor(true, true); //=> false
|
|
18
|
-
* RA.nor(false, true); //=> false
|
|
19
|
-
* RA.nor(true, false); //=> false
|
|
20
|
-
* RA.nor(false, false); //=> true
|
|
21
|
-
* RA.nor(1, 1); //=> false
|
|
22
|
-
* RA.nor(1, 0); //=> false
|
|
23
|
-
* RA.nor(0, 1); //=> false
|
|
24
|
-
* RA.nor(0, 0); //=> true
|
|
25
|
-
*/
|
|
26
|
-
const nor = complement(or); // eslint-disable-line ramda/complement-simplification
|
|
27
|
-
|
|
28
|
-
export default nor;
|
package/src/notAllPass.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { curry, complement, compose, allPass } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Takes a list of predicates and returns a predicate that returns true for a given list of
|
|
5
|
-
* arguments if one or more of the provided predicates is not satisfied by those arguments. It is
|
|
6
|
-
* the complement of Ramda's allPass.
|
|
7
|
-
*
|
|
8
|
-
* The function returned is a curried function whose arity matches that of the
|
|
9
|
-
* highest-arity predicate.
|
|
10
|
-
*
|
|
11
|
-
* @func notAllPass
|
|
12
|
-
* @memberOf RA
|
|
13
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.4.0|v2.4.0}
|
|
14
|
-
* @category Logic
|
|
15
|
-
* @sig [(*... -> Boolean)] -> (*... -> Boolean)
|
|
16
|
-
* @param {Array} predicates An array of predicates to check
|
|
17
|
-
* @return {Function} The combined predicate
|
|
18
|
-
* @see {@link http://ramdajs.com/docs/#allPass|R.allPass}
|
|
19
|
-
* @example
|
|
20
|
-
*
|
|
21
|
-
* const gt10 = R.gt(R.__, 10)
|
|
22
|
-
* const even = (x) => x % 2 === 0;
|
|
23
|
-
* const f = RA.notAllPass([gt10, even]);
|
|
24
|
-
*
|
|
25
|
-
* f(12); //=> false
|
|
26
|
-
* f(8); //=> true
|
|
27
|
-
* f(11); //=> true
|
|
28
|
-
* f(9); //=> true
|
|
29
|
-
*/
|
|
30
|
-
const notAllPass = curry(compose(complement, allPass));
|
|
31
|
-
|
|
32
|
-
export default notAllPass;
|
package/src/notAllUnique.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { complement } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import allUnique from './allUnique.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Returns true if at least one item of the list is repeated. `R.equals` is used to determine equality.
|
|
7
|
-
*
|
|
8
|
-
* @func notAllUnique
|
|
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.allUnique|allUnique}, {@link https://ramdajs.com/docs/#equals|equals}
|
|
16
|
-
* @example
|
|
17
|
-
*
|
|
18
|
-
* RA.notAllUnique([ 1, 1, 2, 3 ]); //=> true
|
|
19
|
-
* RA.notAllUnique([ 1, 2, 3, 4 ]); //=> false
|
|
20
|
-
* RA.notAllUnique([]); //=> false
|
|
21
|
-
*
|
|
22
|
-
*/
|
|
23
|
-
const notAllUnique = complement(allUnique);
|
|
24
|
-
|
|
25
|
-
export default notAllUnique;
|
package/src/notBoth.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { curry, compose, complement, both } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/* eslint-disable max-len */
|
|
4
|
-
/**
|
|
5
|
-
* A function which calls the two provided functions and returns the complement of `&&`ing the
|
|
6
|
-
* results.
|
|
7
|
-
* It returns true if the first function is false-y and the complement of the second function
|
|
8
|
-
* otherwise. Note that this is short-circuited, meaning that the second function will not be
|
|
9
|
-
* invoked if the first returns a false-y value. In short it will return true unless both predicates
|
|
10
|
-
* return true.
|
|
11
|
-
*
|
|
12
|
-
* In addition to functions, `RA.notBoth` also accepts any fantasy-land compatible
|
|
13
|
-
* applicative functor.
|
|
14
|
-
*
|
|
15
|
-
* @func notBoth
|
|
16
|
-
* @memberOf RA
|
|
17
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.3.0|v2.3.0}
|
|
18
|
-
* @category Logic
|
|
19
|
-
* @sig (*... -> Boolean) -> (*... -> Boolean) -> (*... -> Boolean)
|
|
20
|
-
* @param {Function} f A predicate
|
|
21
|
-
* @param {Function} g Another predicate
|
|
22
|
-
* @return {Function} Returns a function that applies its arguments to `f` and `g` and returns the complement of `&&`ing their outputs together.
|
|
23
|
-
* @see {@link http://ramdajs.com/docs/#both|R.both}
|
|
24
|
-
* @example
|
|
25
|
-
*
|
|
26
|
-
* const gt10 = R.gt(R.__, 10)
|
|
27
|
-
* const even = (x) => x % 2 === 0;
|
|
28
|
-
* const f = RA.notBoth(gt10, even);
|
|
29
|
-
*
|
|
30
|
-
* f(12); //=> false
|
|
31
|
-
* f(8); //=> true
|
|
32
|
-
* f(11); //=> true
|
|
33
|
-
* f(9); //=> true
|
|
34
|
-
*/
|
|
35
|
-
/* eslint-enable max-len */
|
|
36
|
-
const notBoth = curry(compose(complement, both));
|
|
37
|
-
|
|
38
|
-
export default notBoth;
|
package/src/notEqual.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { complement, equals } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns `true` if its arguments are not equivalent, `false` otherwise. Handles
|
|
5
|
-
* cyclical data structures.
|
|
6
|
-
*
|
|
7
|
-
* Dispatches symmetrically to the `equals` methods of both arguments, if
|
|
8
|
-
* present.
|
|
9
|
-
*
|
|
10
|
-
* @func notEqual
|
|
11
|
-
* @memberOf RA
|
|
12
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.29.0|v2.29.0}
|
|
13
|
-
* @category Relation
|
|
14
|
-
* @sig a -> b -> Boolean
|
|
15
|
-
* @param {*} a
|
|
16
|
-
* @param {*} b
|
|
17
|
-
* @return {Boolean}
|
|
18
|
-
* @see {@link https://ramdajs.com/docs/#equals|equals}
|
|
19
|
-
* @example
|
|
20
|
-
*
|
|
21
|
-
* RA.notEqual(1, 1); //=> false
|
|
22
|
-
* RA.notEqual(1, '1'); //=> true
|
|
23
|
-
* RA.notEqual([1, 2, 3], [1, 2, 3]); //=> false
|
|
24
|
-
*
|
|
25
|
-
* const a = {}; a.v = a;
|
|
26
|
-
* const b = {}; b.v = b;
|
|
27
|
-
* RA.notEqual(a, b); //=> false
|
|
28
|
-
*/
|
|
29
|
-
const notEqual = complement(equals);
|
|
30
|
-
|
|
31
|
-
export default notEqual;
|
package/src/omitBy.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { complement, identity, pickBy, useWith } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/* eslint-disable max-len */
|
|
4
|
-
/**
|
|
5
|
-
* Returns a partial copy of an object containing only the keys
|
|
6
|
-
* that don't satisfy the supplied predicate.
|
|
7
|
-
*
|
|
8
|
-
* @func omitBy
|
|
9
|
-
* @memberOf RA
|
|
10
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.6.0|v2.6.0}
|
|
11
|
-
* @category Object
|
|
12
|
-
* @sig ((v, k) -> Boolean) -> {k: v} -> {k: v}
|
|
13
|
-
* @param {!Function} pred A predicate to determine whether or not a key should be included on the output object
|
|
14
|
-
* @param {!Object} obj The object to copy from
|
|
15
|
-
* @return {!Object} A new object only with properties that don't satisfy `pred`
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
*
|
|
19
|
-
* const isLowerCase = (val, key) => key.toLowerCase() === key;
|
|
20
|
-
* RA.omitBy(isLowerCase, {a: 1, b: 2, A: 3, B: 4}); //=> {A: 3, B: 4}
|
|
21
|
-
*/
|
|
22
|
-
/* eslint-enable max-len */
|
|
23
|
-
const omitBy = useWith(pickBy, [complement, identity]);
|
|
24
|
-
|
|
25
|
-
export default omitBy;
|
package/src/omitIndexes.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { includes, curry, addIndex, reject } from 'ramda';
|
|
2
|
-
|
|
3
|
-
// helpers
|
|
4
|
-
const rejectIndexed = addIndex(reject);
|
|
5
|
-
const containsIndex = curry((indexes, val, index) => includes(index, indexes));
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Returns a partial copy of an array omitting the indexes specified.
|
|
9
|
-
*
|
|
10
|
-
* @func omitIndexes
|
|
11
|
-
* @memberOf RA
|
|
12
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/1.19.0|v1.19.0}
|
|
13
|
-
* @category List
|
|
14
|
-
* @sig [Int] -> [a] -> [a]
|
|
15
|
-
* @see {@link http://ramdajs.com/docs/#omit|R.omit}, {@link RA.pickIndexes|pickIndexes}
|
|
16
|
-
* @param {!Array} indexes The array of indexes to omit from the new array
|
|
17
|
-
* @param {!Array} list The array to copy from
|
|
18
|
-
* @return {!Array} The new array with omitted indexes
|
|
19
|
-
* @example
|
|
20
|
-
*
|
|
21
|
-
* RA.omitIndexes([-1, 1, 3], ['a', 'b', 'c', 'd']); //=> ['a', 'c']
|
|
22
|
-
*/
|
|
23
|
-
const omitIndexes = curry((indexes, list) =>
|
|
24
|
-
rejectIndexed(containsIndex(indexes), list)
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
export default omitIndexes;
|
package/src/overlaps.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { pipe, isNotEmpty, intersection, isEmpty, curryN } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns true if two lists have at least one element common to both lists.
|
|
5
|
-
*
|
|
6
|
-
* @func overlaps
|
|
7
|
-
* @memberOf RA
|
|
8
|
-
* @category Relation
|
|
9
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.30.0|v2.30.0}
|
|
10
|
-
* @sig [a] -> [a] -> Boolean
|
|
11
|
-
* @param {Array} list1 The first list
|
|
12
|
-
* @param {Array} list2 The second list
|
|
13
|
-
* @return {boolean} True if two lists have at least one element common to both lists
|
|
14
|
-
* @example
|
|
15
|
-
*
|
|
16
|
-
* RA.overlaps(['-v', '--verbose'], ['node', 'script.js', '-v']); //=> true
|
|
17
|
-
* RA.overlaps(['-v', '--verbose'], []); //=> false
|
|
18
|
-
* RA.overlaps([1, 2, 3], [3, 4, 5]); //=> true
|
|
19
|
-
* RA.overlaps([1, 2, 3], [4, 5]); //=> false
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
const overlaps = curryN(2, (list1, list2) => {
|
|
23
|
-
if (isEmpty(list1)) {
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return pipe(intersection, isNotEmpty)(list1, list2);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
export default overlaps;
|
package/src/padCharsEnd.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { curry, invoker, flip } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import ponyfill from './internal/ponyfills/String.padEnd.js';
|
|
4
|
-
import isFunction from './isFunction.js';
|
|
5
|
-
|
|
6
|
-
export const padEndPonyfill = curry(ponyfill);
|
|
7
|
-
|
|
8
|
-
export const padEndInvoker = flip(invoker(2, 'padEnd'));
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* The function pads the current string with a given string
|
|
12
|
-
* (repeated, if needed) so that the resulting string reaches a given length.
|
|
13
|
-
* The padding is applied from the end of the current string.
|
|
14
|
-
*
|
|
15
|
-
* @func padCharsEnd
|
|
16
|
-
* @memberOf RA
|
|
17
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.22.0|v2.22.0}
|
|
18
|
-
* @category String
|
|
19
|
-
* @sig String -> Number -> String -> String
|
|
20
|
-
* @param {string} padString The string to pad the current string with
|
|
21
|
-
* @param {number} targetLength The length of the resulting string once
|
|
22
|
-
* the current string has been padded
|
|
23
|
-
* @param {string} value String value to be padded
|
|
24
|
-
* @return {string} A new string of the specified length with the pad string
|
|
25
|
-
* applied at the end of the current string
|
|
26
|
-
* @see {@link RA.padEnd|padEnd}, {@link RA.padCharsStart|padCharsStart}, {@link RA.padStart|padStart}
|
|
27
|
-
* @example
|
|
28
|
-
*
|
|
29
|
-
* RA.padCharsEnd('-', 3, 'a'); // => 'a--'
|
|
30
|
-
* RA.padCharsEnd('foo', 10, 'abc'); // => 'abcfoofoof'
|
|
31
|
-
* RA.padCharsEnd('123456', 6, 'abc'); // => 'abc123'
|
|
32
|
-
*/
|
|
33
|
-
const padCharsEnd = isFunction(String.prototype.padEnd)
|
|
34
|
-
? padEndInvoker
|
|
35
|
-
: padEndPonyfill;
|
|
36
|
-
|
|
37
|
-
export default padCharsEnd;
|
package/src/padCharsStart.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { flip, invoker, curry } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import isFunction from './isFunction.js';
|
|
4
|
-
import ponyfill from './internal/ponyfills/String.padStart.js';
|
|
5
|
-
|
|
6
|
-
export const padStartInvoker = flip(invoker(2, 'padStart'));
|
|
7
|
-
|
|
8
|
-
export const padStartPonyfill = curry(ponyfill);
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* The function pads the current string with a given string
|
|
12
|
-
* (repeated, if needed) so that the resulting string reaches a given length.
|
|
13
|
-
* The padding is applied from the start of the current string.
|
|
14
|
-
*
|
|
15
|
-
* @func padCharsStart
|
|
16
|
-
* @memberOf RA
|
|
17
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.22.0|v2.22.0}
|
|
18
|
-
* @category String
|
|
19
|
-
* @sig String -> Number -> String -> String
|
|
20
|
-
* @param {string} padString The string to pad the current string with
|
|
21
|
-
* @param {number} targetLength The length of the resulting string once the current string has been padded
|
|
22
|
-
* @param {string} value String value to be padded
|
|
23
|
-
* @return {string} A new string of the specified length with the pad string on the start of current string
|
|
24
|
-
* @see {@link RA.padStart|padStart}, {@link RA.padEnd|padEnd}, {@link RA.padCharsEnd|padCharsEnd}
|
|
25
|
-
* @example
|
|
26
|
-
*
|
|
27
|
-
* RA.padCharsStart('-', 3, 'a'); // => '--a'
|
|
28
|
-
* RA.padCharsStart('foo', 10, 'abc'); // => 'foofoofabc'
|
|
29
|
-
* RA.padCharsStart('123456', 6, 'abc'); // => '123abc'
|
|
30
|
-
*/
|
|
31
|
-
const padCharsStart = isFunction(String.prototype.padStart)
|
|
32
|
-
? padStartInvoker
|
|
33
|
-
: padStartPonyfill;
|
|
34
|
-
|
|
35
|
-
export default padCharsStart;
|
package/src/padEnd.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import padCharsEnd from './padCharsEnd.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The function pads the current string with an empty string
|
|
5
|
-
* so that the resulting string reaches a given length.
|
|
6
|
-
* The padding is applied from the end of the current string.
|
|
7
|
-
*
|
|
8
|
-
* @func padEnd
|
|
9
|
-
* @memberOf RA
|
|
10
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.22.0|v2.22.0}
|
|
11
|
-
* @category String
|
|
12
|
-
* @sig Number -> String -> String
|
|
13
|
-
* @param {number} targetLength The length of the resulting string once
|
|
14
|
-
* the current string has been padded
|
|
15
|
-
* @param {string} value String value to be padded
|
|
16
|
-
* @return {string} A new string of the specified length with the pad string
|
|
17
|
-
* applied at the end of the current string
|
|
18
|
-
* @see {@link RA.padCharsEnd|padCharsEnd}, {@link RA.padCharsStart|padCharsStart}, {@link RA.padStart|padStart}
|
|
19
|
-
* @example
|
|
20
|
-
*
|
|
21
|
-
* RA.padEnd(3, 'a'); // => 'a '
|
|
22
|
-
*/
|
|
23
|
-
const padEnd = padCharsEnd(' ');
|
|
24
|
-
|
|
25
|
-
export default padEnd;
|
package/src/padStart.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import padCharsStart from './padCharsStart.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Pads string on the left side if it's shorter than length.
|
|
5
|
-
*
|
|
6
|
-
* @func padStart
|
|
7
|
-
* @memberOf RA
|
|
8
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.25.0|v2.25.0}
|
|
9
|
-
* @category String
|
|
10
|
-
* @sig Number -> String -> String
|
|
11
|
-
* @param {number} targetLength The length of the resulting string once
|
|
12
|
-
* the current string has been padded
|
|
13
|
-
* @param {string} value String value to be padded
|
|
14
|
-
* @return {string} A new string of the specified length with the empty string
|
|
15
|
-
* applied to the beginning of the current string
|
|
16
|
-
* @see {@link RA.padCharsEnd|padCharsEnd}, {@link RA.padCharsStart|padCharsStart}, {@link RA.padEnd|padEnd}
|
|
17
|
-
* @example
|
|
18
|
-
*
|
|
19
|
-
* RA.padStart(3, 'a'); // => ' a'
|
|
20
|
-
*/
|
|
21
|
-
const padStart = padCharsStart(' ');
|
|
22
|
-
|
|
23
|
-
export default padStart;
|
package/src/pathNotEq.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { pathEq, complement } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/* eslint-disable max-len */
|
|
4
|
-
/**
|
|
5
|
-
* Determines whether a nested path on an object doesn't have a specific value,
|
|
6
|
-
* in R.equals terms. Most likely used to filter a list.
|
|
7
|
-
*
|
|
8
|
-
* @func pathNotEq
|
|
9
|
-
* @memberOf RA
|
|
10
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.4.0|v2.4.0}
|
|
11
|
-
* @category Relation
|
|
12
|
-
* @sig a => [Idx] => {a} => Boolean
|
|
13
|
-
* @sig Idx = String | Int | Symbol
|
|
14
|
-
* @param {a} val The value to compare the nested property with
|
|
15
|
-
* @param {Array} path The path of the nested property to use
|
|
16
|
-
* @param {Object} object The object to check the nested property in
|
|
17
|
-
* @return {boolean} Returns Boolean `false` if the value equals the nested object property, `true` otherwise
|
|
18
|
-
* @see {@link http://ramdajs.com/docs/#pathEq|R.pathEq}
|
|
19
|
-
* @example
|
|
20
|
-
*
|
|
21
|
-
* const user1 = { address: { zipCode: 90210 } };
|
|
22
|
-
* const user2 = { address: { zipCode: 55555 } };
|
|
23
|
-
* const user3 = { name: 'Bob' };
|
|
24
|
-
* const users = [ user1, user2, user3 ];
|
|
25
|
-
* const isFamous = RA.pathNotEq(90210, ['address', 'zipCode']);
|
|
26
|
-
* R.filter(isFamous, users); //=> [ user2, user3 ]
|
|
27
|
-
*/
|
|
28
|
-
/* eslint-enable max-len */
|
|
29
|
-
const pathNotEq = complement(pathEq);
|
|
30
|
-
|
|
31
|
-
export default pathNotEq;
|
package/src/pathOrLazy.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { curryN, identical, partial, pathOr, unary, when } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* If the given, non-null object has a value at the given path, returns the value at that path.
|
|
5
|
-
* Otherwise returns the result of invoking the provided function with the object.
|
|
6
|
-
*
|
|
7
|
-
* @func pathOrLazy
|
|
8
|
-
* @memberOf RA
|
|
9
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.22.0|v2.22.0}
|
|
10
|
-
* @category Object
|
|
11
|
-
* @typedef Idx = String | Int
|
|
12
|
-
* @sig ({a} -> a) -> [Idx] -> {a} -> a
|
|
13
|
-
* @param {Function} defaultFn The function that will return the default value.
|
|
14
|
-
* @param {Array} path The path to use.
|
|
15
|
-
* @param {Object} obj The object to retrieve the nested property from.
|
|
16
|
-
* @return {*} The data at `path` of the supplied object or the default value.
|
|
17
|
-
* @example
|
|
18
|
-
*
|
|
19
|
-
* RA.pathOrLazy(() => 'N/A', ['a', 'b'], {a: {b: 2}}); //=> 2
|
|
20
|
-
* RA.pathOrLazy(() => 'N/A', ['a', 'b'], {c: {b: 2}}); //=> "N/A"
|
|
21
|
-
*/
|
|
22
|
-
const pathOrLazy = curryN(3, (defaultFn, path, obj) =>
|
|
23
|
-
when(
|
|
24
|
-
identical(defaultFn),
|
|
25
|
-
partial(unary(defaultFn), [obj]),
|
|
26
|
-
pathOr(defaultFn, path, obj)
|
|
27
|
-
)
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
export default pathOrLazy;
|
package/src/paths.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { curry, ap, path, __ } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Acts as multiple path: arrays of paths in, array of values out. Preserves order.
|
|
5
|
-
*
|
|
6
|
-
* @func paths
|
|
7
|
-
* @memberOf RA
|
|
8
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/1.2.0|v1.2.0}
|
|
9
|
-
* @category List
|
|
10
|
-
* @sig [[k]] -> {k: v} - [v]
|
|
11
|
-
* @param {Array} ps The property paths to fetch
|
|
12
|
-
* @param {Object} obj The object to query
|
|
13
|
-
* @return {Array} The corresponding values or partially applied function
|
|
14
|
-
* @see {@link https://github.com/ramda/ramda/wiki/Cookbook#derivative-of-rprops-for-deep-fields|Ramda Cookbook}, {@link http://ramdajs.com/docs/#props|R.props}
|
|
15
|
-
* @example
|
|
16
|
-
*
|
|
17
|
-
* const obj = {
|
|
18
|
-
* a: { b: { c: 1 } },
|
|
19
|
-
* x: 2,
|
|
20
|
-
* };
|
|
21
|
-
*
|
|
22
|
-
* RA.paths([['a', 'b', 'c'], ['x']], obj); //=> [1, 2]
|
|
23
|
-
*/
|
|
24
|
-
const paths = curry((ps, obj) => ap([path(__, obj)], ps));
|
|
25
|
-
|
|
26
|
-
export default paths;
|