ramda-adjunct 2.36.0 → 3.2.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 +49 -0
- package/README.md +2 -2
- package/dist/RA.node.js +226 -210
- package/dist/RA.node.min.js +1 -1
- package/dist/RA.web.js +226 -210
- package/dist/RA.web.min.js +1 -1
- package/dist/RA.web.standalone.js +5993 -5468
- package/dist/RA.web.standalone.min.js +1 -1
- package/es/flattenPath.js +2 -2
- package/es/included.js +27 -0
- package/es/index.js +9 -12
- package/es/internal/ponyfills/Promise.any.js +3 -3
- package/es/isBlank.js +32 -0
- package/es/isUinteger32.js +29 -0
- package/es/mergePath.js +2 -3
- package/es/omitIndexes.js +2 -2
- package/es/pickIndexes.js +2 -2
- package/es/sortByPaths.js +52 -0
- package/es/spreadPath.js +2 -2
- package/es/trimCharsEnd.js +2 -2
- package/es/trimCharsStart.js +2 -2
- package/lib/flattenPath.js +1 -1
- package/lib/included.js +33 -0
- package/lib/index.js +18 -21
- package/lib/internal/ponyfills/Promise.any.js +3 -3
- package/lib/isBlank.js +41 -0
- package/lib/isUinteger32.js +38 -0
- package/lib/mergePath.js +1 -5
- package/lib/omitIndexes.js +1 -1
- package/lib/pickIndexes.js +1 -1
- package/lib/sortByPaths.js +59 -0
- package/lib/spreadPath.js +1 -1
- package/lib/trimCharsEnd.js +2 -2
- package/lib/trimCharsStart.js +2 -2
- package/package.json +33 -49
- package/src/flattenPath.js +4 -2
- package/src/included.js +28 -0
- package/src/index.js +7 -10
- package/src/isBlank.js +33 -0
- package/src/isUinteger32.js +29 -0
- package/src/mergePath.js +2 -4
- package/src/omitIndexes.js +2 -2
- package/src/pickIndexes.js +2 -2
- package/src/sortByPaths.js +55 -0
- package/src/spreadPath.js +2 -2
- package/src/trimCharsEnd.js +2 -2
- package/src/trimCharsStart.js +2 -2
- package/types/index.d.ts +21 -34
- package/es/contained.js +0 -29
- package/es/hasPath.js +0 -38
- package/es/mergeRight.js +0 -26
- package/es/thenP.js +0 -28
- package/lib/contained.js +0 -35
- package/lib/hasPath.js +0 -47
- package/lib/mergeRight.js +0 -32
- package/lib/thenP.js +0 -34
- package/src/contained.js +0 -30
- package/src/hasPath.js +0 -40
- package/src/mergeRight.js +0 -27
- package/src/thenP.js +0 -29
package/types/index.d.ts
CHANGED
|
@@ -360,6 +360,12 @@ declare namespace RamdaAdjunct {
|
|
|
360
360
|
*/
|
|
361
361
|
isInteger32(val: any): boolean;
|
|
362
362
|
|
|
363
|
+
/**
|
|
364
|
+
* Checks whether the passed value is an unsigned 32 bit integer number.
|
|
365
|
+
*/
|
|
366
|
+
isUinteger32(val: any): boolean;
|
|
367
|
+
isUint32(val: any): boolean; // alias
|
|
368
|
+
|
|
363
369
|
/**
|
|
364
370
|
* Checks whether the passed value is complement of `integer`.
|
|
365
371
|
*/
|
|
@@ -370,6 +376,12 @@ declare namespace RamdaAdjunct {
|
|
|
370
376
|
*/
|
|
371
377
|
isBigInt(val: any): boolean;
|
|
372
378
|
|
|
379
|
+
/**
|
|
380
|
+
* Returns `true` if the given value is its type's empty value, `false`, `undefined`
|
|
381
|
+
* as well as strings containing only whitespace characters; `false` otherwise.
|
|
382
|
+
*/
|
|
383
|
+
isBlank(val: any): boolean;
|
|
384
|
+
|
|
373
385
|
/**
|
|
374
386
|
* Checks whether the passed value is a `float`.
|
|
375
387
|
*/
|
|
@@ -629,19 +641,6 @@ declare namespace RamdaAdjunct {
|
|
|
629
641
|
(key: string): (obj: object) => object;
|
|
630
642
|
};
|
|
631
643
|
|
|
632
|
-
/**
|
|
633
|
-
* Create a new object with the own properties of the second object merged with
|
|
634
|
-
* the own properties of the first object. If a key exists in both objects,
|
|
635
|
-
* the value from the first object will be used. *
|
|
636
|
-
* Putting it simply: it sets properties only if they don't exist.
|
|
637
|
-
*/
|
|
638
|
-
mergeRight(source: object, destination: object): object;
|
|
639
|
-
mergeRight(source: object): (destination: object) => object;
|
|
640
|
-
mergeLeft(source: object, destination: object): object; // alias
|
|
641
|
-
mergeLeft(source: object): (destination: object) => object; // alias
|
|
642
|
-
resetToDefault(defaultOptions: object, options: object): object; // alias of mergeRight
|
|
643
|
-
resetToDefault(defaultOptions: object): (options: object) => object; // alias of mergeRight
|
|
644
|
-
|
|
645
644
|
/**
|
|
646
645
|
* Functional equivalent of merging object properties with object spread.
|
|
647
646
|
*/
|
|
@@ -901,12 +900,6 @@ declare namespace RamdaAdjunct {
|
|
|
901
900
|
(high: number): (value: number) => boolean;
|
|
902
901
|
};
|
|
903
902
|
|
|
904
|
-
/**
|
|
905
|
-
* Returns whether or not an object has an own property with the specified name at a given path.
|
|
906
|
-
*/
|
|
907
|
-
hasPath(path: Array<string | number>, obj: object): boolean;
|
|
908
|
-
hasPath(path: Array<string | number>): (obj: object) => boolean;
|
|
909
|
-
|
|
910
903
|
/**
|
|
911
904
|
* Spreads object under property path onto provided object.
|
|
912
905
|
*/
|
|
@@ -1018,16 +1011,6 @@ declare namespace RamdaAdjunct {
|
|
|
1018
1011
|
catchP<A, B = unknown>(onRejected: (error: any) => B | Promise<B>, promise: Promise<A>): Promise<A | B>;
|
|
1019
1012
|
catchP<A, B = unknown>(onRejected: (error: any) => B | Promise<B>): (promise: Promise<A>) => Promise<A | B>;
|
|
1020
1013
|
|
|
1021
|
-
/**
|
|
1022
|
-
* Composable shortcut for `Promise.then`.
|
|
1023
|
-
* The thenP function returns a Promise. It takes two arguments: a callback function for the success of the Promise
|
|
1024
|
-
* and the promise instance itself.
|
|
1025
|
-
*/
|
|
1026
|
-
thenP<T>(onFulfilled: Function, thenable: Promise<T>): Promise<T>;
|
|
1027
|
-
thenP<T>(onFulfilled: Function): (thenable: Promise<T>) => Promise<T>;
|
|
1028
|
-
then<T>(onFulfilled: Function, thenable: Promise<T>): Promise<T>;
|
|
1029
|
-
then<T>(onFulfilled: Function): (thenable: Promise<T>) => Promise<T>;
|
|
1030
|
-
|
|
1031
1014
|
/**
|
|
1032
1015
|
* Composable shortcut for `Promise.then` that allows for success and failure call backs.
|
|
1033
1016
|
* The thenCatchP function returns a Promise. It takes three arguments: a callback function for the success of the Promise,
|
|
@@ -1323,12 +1306,10 @@ declare namespace RamdaAdjunct {
|
|
|
1323
1306
|
* to at least one element of the given list or false otherwise.
|
|
1324
1307
|
* Given list can be a string.
|
|
1325
1308
|
*
|
|
1326
|
-
* Like {@link http://ramdajs.com/docs/#contains|R.
|
|
1309
|
+
* Like {@link http://ramdajs.com/docs/#contains|R.includes} but with argument order reversed.
|
|
1327
1310
|
*/
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
included<T>(list: T[], val: T): boolean; // alias
|
|
1331
|
-
included<T>(list: T[]): (val: T) => boolean; // alias
|
|
1311
|
+
included<T>(list: T[], val: T): boolean;
|
|
1312
|
+
included<T>(list: T[]): (val: T) => boolean;
|
|
1332
1313
|
|
|
1333
1314
|
/**
|
|
1334
1315
|
* Can be used as a way to compose multiple invokers together to form polymorphic functions,
|
|
@@ -1508,6 +1489,12 @@ declare namespace RamdaAdjunct {
|
|
|
1508
1489
|
skipTake<T>(n: number, list: T[]): T[];
|
|
1509
1490
|
skipTake<T>(n: number): (list: T[]) => T[];
|
|
1510
1491
|
|
|
1492
|
+
/**
|
|
1493
|
+
* Sort a list of objects by a list of paths (if first path value is equivalent, sort by second, etc).
|
|
1494
|
+
*/
|
|
1495
|
+
sortByPaths(props: string[][], list: object[]): object[];
|
|
1496
|
+
sortByPaths(props: string[][]): (list: object[]) => object[];
|
|
1497
|
+
|
|
1511
1498
|
/**
|
|
1512
1499
|
* Determine if input value is an indexed data type.
|
|
1513
1500
|
*/
|
package/es/contained.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { flip, contains } from 'ramda';
|
|
2
|
-
/**
|
|
3
|
-
* Returns true if the specified value is equal, in R.equals terms,
|
|
4
|
-
* to at least one element of the given list or false otherwise.
|
|
5
|
-
* Given list can be a string.
|
|
6
|
-
*
|
|
7
|
-
* Like {@link http://ramdajs.com/docs/#contains|R.contains} but with argument order reversed.
|
|
8
|
-
*
|
|
9
|
-
* @func contained
|
|
10
|
-
* @aliases included
|
|
11
|
-
* @memberOf RA
|
|
12
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.8.0|v2.8.0}
|
|
13
|
-
* @deprecated since v2.12.0; please use RA.included alias
|
|
14
|
-
* @category List
|
|
15
|
-
* @sig [a] -> a -> Boolean
|
|
16
|
-
* @param {Array|String} list The list to consider
|
|
17
|
-
* @param {*} a The item to compare against
|
|
18
|
-
* @return {boolean} Returns Boolean `true` if an equivalent item is in the list or `false` otherwise
|
|
19
|
-
* @see {@link http://ramdajs.com/docs/#contains|R.contains}
|
|
20
|
-
* @example
|
|
21
|
-
*
|
|
22
|
-
* RA.contained([1, 2, 3], 3); //=> true
|
|
23
|
-
* RA.contained([1, 2, 3], 4); //=> false
|
|
24
|
-
* RA.contained([{ name: 'Fred' }], { name: 'Fred' }); //=> true
|
|
25
|
-
* RA.contained([[42]], [42]); //=> true
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
var contained = flip(contains);
|
|
29
|
-
export default contained;
|
package/es/hasPath.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { length, has, path, head, tail, curryN } from 'ramda';
|
|
2
|
-
import isObj from './isObj';
|
|
3
|
-
/**
|
|
4
|
-
* Returns whether or not an object has an own property with the specified name at a given path.
|
|
5
|
-
*
|
|
6
|
-
* @func hasPath
|
|
7
|
-
* @memberOf RA
|
|
8
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/1.14.0|v1.14.0}
|
|
9
|
-
* @deprecated since v2.12.0; ramda@0.26.0 contains hasPath
|
|
10
|
-
* @category Object
|
|
11
|
-
* @typedef Idx = String | Int
|
|
12
|
-
* @sig [Idx] -> {a} -> Boolean
|
|
13
|
-
* @param {Array.<string|number>} path The path of the nested property
|
|
14
|
-
* @param {Object} obj The object to test
|
|
15
|
-
* @return {boolean}
|
|
16
|
-
* @see {@link http://ramdajs.com/docs/#has|R.has}
|
|
17
|
-
* @example
|
|
18
|
-
*
|
|
19
|
-
* RA.hasPath(['a', 'b'], { a: { b: 1 } }); //=> true
|
|
20
|
-
* RA.hasPath(['a', 'b', 'c'], { a: { b: 1 } }); //=> false
|
|
21
|
-
* RA.hasPath(['a', 'b'], { a: { } }); //=> false
|
|
22
|
-
* RA.hasPath([0], [1, 2]); //=> true
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
var hasPath = curryN(2, function (objPath, obj) {
|
|
26
|
-
var prop = head(objPath); // termination conditions
|
|
27
|
-
|
|
28
|
-
if (length(objPath) === 0 || !isObj(obj)) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (length(objPath) === 1) {
|
|
33
|
-
return has(prop, obj);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return hasPath(tail(objPath), path([prop], obj)); // base case
|
|
37
|
-
});
|
|
38
|
-
export default hasPath;
|
package/es/mergeRight.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { merge, flip } from 'ramda';
|
|
2
|
-
/**
|
|
3
|
-
* Create a new object with the own properties of the second object merged with
|
|
4
|
-
* the own properties of the first object. If a key exists in both objects,
|
|
5
|
-
* the value from the first object will be used. *
|
|
6
|
-
* Putting it simply: it sets properties only if they don't exist.
|
|
7
|
-
*
|
|
8
|
-
* @func mergeRight
|
|
9
|
-
* @deprecated since v2.12.0; available in ramda@0.26.0 as R.mergeLeft
|
|
10
|
-
* @aliases mergeLeft, resetToDefault
|
|
11
|
-
* @memberOf RA
|
|
12
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/1.6.0|v1.6.0}
|
|
13
|
-
* @category Object
|
|
14
|
-
* @sig {k: v} -> {k: v} -> {k: v}
|
|
15
|
-
* @param {Object} r Destination
|
|
16
|
-
* @param {Object} l Source
|
|
17
|
-
* @return {Object}
|
|
18
|
-
* @see {@link http://ramdajs.com/docs/#merge|R.merge}, {@link https://github.com/ramda/ramda/wiki/Cookbook#set-properties-only-if-they-dont-exist|Ramda Cookbook}
|
|
19
|
-
* @example
|
|
20
|
-
*
|
|
21
|
-
* RA.mergeRight({ 'age': 40 }, { 'name': 'fred', 'age': 10 });
|
|
22
|
-
* //=> { 'name': 'fred', 'age': 40 }
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
var mergeRight = flip(merge);
|
|
26
|
-
export default mergeRight;
|
package/es/thenP.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { invoker } from 'ramda';
|
|
2
|
-
/**
|
|
3
|
-
* Composable shortcut for `Promise.then`.
|
|
4
|
-
* The thenP function returns a Promise. It takes two arguments: a callback function for the success of the Promise
|
|
5
|
-
* and the promise instance itself.
|
|
6
|
-
*
|
|
7
|
-
* @func thenP
|
|
8
|
-
* @memberOf RA
|
|
9
|
-
* @aliases then
|
|
10
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.8.0|v2.8.0}
|
|
11
|
-
* @deprecated since v2.12.0; available in ramda@0.26.0 as R.then
|
|
12
|
-
* @category Function
|
|
13
|
-
* @sig (a -> Promise b | b) -> Promise b
|
|
14
|
-
* @param {Function} onFulfilled A Function called if the Promise is fulfilled. This function has one argument, the fulfillment value
|
|
15
|
-
* @param {Promise} promise Any Promise or Thenable object
|
|
16
|
-
* @return {Promise} A Promise in the pending status
|
|
17
|
-
|
|
18
|
-
* @see {@link RA.resolveP|resolveP}, {@link RA.rejectP|rejectP}, {@link RA.allP|allP}
|
|
19
|
-
* @example
|
|
20
|
-
*
|
|
21
|
-
* const promise = Promise.resolve(1);
|
|
22
|
-
* const add1 = v => v + 1;
|
|
23
|
-
*
|
|
24
|
-
* RA.thenP(add1, promise); // => Promise(2)
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
var thenP = invoker(1, 'then');
|
|
28
|
-
export default thenP;
|
package/lib/contained.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports["default"] = void 0;
|
|
5
|
-
|
|
6
|
-
var _ramda = require("ramda");
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Returns true if the specified value is equal, in R.equals terms,
|
|
10
|
-
* to at least one element of the given list or false otherwise.
|
|
11
|
-
* Given list can be a string.
|
|
12
|
-
*
|
|
13
|
-
* Like {@link http://ramdajs.com/docs/#contains|R.contains} but with argument order reversed.
|
|
14
|
-
*
|
|
15
|
-
* @func contained
|
|
16
|
-
* @aliases included
|
|
17
|
-
* @memberOf RA
|
|
18
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.8.0|v2.8.0}
|
|
19
|
-
* @deprecated since v2.12.0; please use RA.included alias
|
|
20
|
-
* @category List
|
|
21
|
-
* @sig [a] -> a -> Boolean
|
|
22
|
-
* @param {Array|String} list The list to consider
|
|
23
|
-
* @param {*} a The item to compare against
|
|
24
|
-
* @return {boolean} Returns Boolean `true` if an equivalent item is in the list or `false` otherwise
|
|
25
|
-
* @see {@link http://ramdajs.com/docs/#contains|R.contains}
|
|
26
|
-
* @example
|
|
27
|
-
*
|
|
28
|
-
* RA.contained([1, 2, 3], 3); //=> true
|
|
29
|
-
* RA.contained([1, 2, 3], 4); //=> false
|
|
30
|
-
* RA.contained([{ name: 'Fred' }], { name: 'Fred' }); //=> true
|
|
31
|
-
* RA.contained([[42]], [42]); //=> true
|
|
32
|
-
*/
|
|
33
|
-
var contained = (0, _ramda.flip)(_ramda.contains);
|
|
34
|
-
var _default = contained;
|
|
35
|
-
exports["default"] = _default;
|
package/lib/hasPath.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports["default"] = void 0;
|
|
5
|
-
|
|
6
|
-
var _ramda = require("ramda");
|
|
7
|
-
|
|
8
|
-
var _isObj = _interopRequireDefault(require("./isObj"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Returns whether or not an object has an own property with the specified name at a given path.
|
|
14
|
-
*
|
|
15
|
-
* @func hasPath
|
|
16
|
-
* @memberOf RA
|
|
17
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/1.14.0|v1.14.0}
|
|
18
|
-
* @deprecated since v2.12.0; ramda@0.26.0 contains hasPath
|
|
19
|
-
* @category Object
|
|
20
|
-
* @typedef Idx = String | Int
|
|
21
|
-
* @sig [Idx] -> {a} -> Boolean
|
|
22
|
-
* @param {Array.<string|number>} path The path of the nested property
|
|
23
|
-
* @param {Object} obj The object to test
|
|
24
|
-
* @return {boolean}
|
|
25
|
-
* @see {@link http://ramdajs.com/docs/#has|R.has}
|
|
26
|
-
* @example
|
|
27
|
-
*
|
|
28
|
-
* RA.hasPath(['a', 'b'], { a: { b: 1 } }); //=> true
|
|
29
|
-
* RA.hasPath(['a', 'b', 'c'], { a: { b: 1 } }); //=> false
|
|
30
|
-
* RA.hasPath(['a', 'b'], { a: { } }); //=> false
|
|
31
|
-
* RA.hasPath([0], [1, 2]); //=> true
|
|
32
|
-
*/
|
|
33
|
-
var hasPath = (0, _ramda.curryN)(2, function (objPath, obj) {
|
|
34
|
-
var prop = (0, _ramda.head)(objPath); // termination conditions
|
|
35
|
-
|
|
36
|
-
if ((0, _ramda.length)(objPath) === 0 || !(0, _isObj["default"])(obj)) {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if ((0, _ramda.length)(objPath) === 1) {
|
|
41
|
-
return (0, _ramda.has)(prop, obj);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return hasPath((0, _ramda.tail)(objPath), (0, _ramda.path)([prop], obj)); // base case
|
|
45
|
-
});
|
|
46
|
-
var _default = hasPath;
|
|
47
|
-
exports["default"] = _default;
|
package/lib/mergeRight.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports["default"] = void 0;
|
|
5
|
-
|
|
6
|
-
var _ramda = require("ramda");
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Create a new object with the own properties of the second object merged with
|
|
10
|
-
* the own properties of the first object. If a key exists in both objects,
|
|
11
|
-
* the value from the first object will be used. *
|
|
12
|
-
* Putting it simply: it sets properties only if they don't exist.
|
|
13
|
-
*
|
|
14
|
-
* @func mergeRight
|
|
15
|
-
* @deprecated since v2.12.0; available in ramda@0.26.0 as R.mergeLeft
|
|
16
|
-
* @aliases mergeLeft, resetToDefault
|
|
17
|
-
* @memberOf RA
|
|
18
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/1.6.0|v1.6.0}
|
|
19
|
-
* @category Object
|
|
20
|
-
* @sig {k: v} -> {k: v} -> {k: v}
|
|
21
|
-
* @param {Object} r Destination
|
|
22
|
-
* @param {Object} l Source
|
|
23
|
-
* @return {Object}
|
|
24
|
-
* @see {@link http://ramdajs.com/docs/#merge|R.merge}, {@link https://github.com/ramda/ramda/wiki/Cookbook#set-properties-only-if-they-dont-exist|Ramda Cookbook}
|
|
25
|
-
* @example
|
|
26
|
-
*
|
|
27
|
-
* RA.mergeRight({ 'age': 40 }, { 'name': 'fred', 'age': 10 });
|
|
28
|
-
* //=> { 'name': 'fred', 'age': 40 }
|
|
29
|
-
*/
|
|
30
|
-
var mergeRight = (0, _ramda.flip)(_ramda.merge);
|
|
31
|
-
var _default = mergeRight;
|
|
32
|
-
exports["default"] = _default;
|
package/lib/thenP.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports["default"] = void 0;
|
|
5
|
-
|
|
6
|
-
var _ramda = require("ramda");
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Composable shortcut for `Promise.then`.
|
|
10
|
-
* The thenP function returns a Promise. It takes two arguments: a callback function for the success of the Promise
|
|
11
|
-
* and the promise instance itself.
|
|
12
|
-
*
|
|
13
|
-
* @func thenP
|
|
14
|
-
* @memberOf RA
|
|
15
|
-
* @aliases then
|
|
16
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.8.0|v2.8.0}
|
|
17
|
-
* @deprecated since v2.12.0; available in ramda@0.26.0 as R.then
|
|
18
|
-
* @category Function
|
|
19
|
-
* @sig (a -> Promise b | b) -> Promise b
|
|
20
|
-
* @param {Function} onFulfilled A Function called if the Promise is fulfilled. This function has one argument, the fulfillment value
|
|
21
|
-
* @param {Promise} promise Any Promise or Thenable object
|
|
22
|
-
* @return {Promise} A Promise in the pending status
|
|
23
|
-
|
|
24
|
-
* @see {@link RA.resolveP|resolveP}, {@link RA.rejectP|rejectP}, {@link RA.allP|allP}
|
|
25
|
-
* @example
|
|
26
|
-
*
|
|
27
|
-
* const promise = Promise.resolve(1);
|
|
28
|
-
* const add1 = v => v + 1;
|
|
29
|
-
*
|
|
30
|
-
* RA.thenP(add1, promise); // => Promise(2)
|
|
31
|
-
*/
|
|
32
|
-
var thenP = (0, _ramda.invoker)(1, 'then');
|
|
33
|
-
var _default = thenP;
|
|
34
|
-
exports["default"] = _default;
|
package/src/contained.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { flip, contains } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns true if the specified value is equal, in R.equals terms,
|
|
5
|
-
* to at least one element of the given list or false otherwise.
|
|
6
|
-
* Given list can be a string.
|
|
7
|
-
*
|
|
8
|
-
* Like {@link http://ramdajs.com/docs/#contains|R.contains} but with argument order reversed.
|
|
9
|
-
*
|
|
10
|
-
* @func contained
|
|
11
|
-
* @aliases included
|
|
12
|
-
* @memberOf RA
|
|
13
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.8.0|v2.8.0}
|
|
14
|
-
* @deprecated since v2.12.0; please use RA.included alias
|
|
15
|
-
* @category List
|
|
16
|
-
* @sig [a] -> a -> Boolean
|
|
17
|
-
* @param {Array|String} list The list to consider
|
|
18
|
-
* @param {*} a The item to compare against
|
|
19
|
-
* @return {boolean} Returns Boolean `true` if an equivalent item is in the list or `false` otherwise
|
|
20
|
-
* @see {@link http://ramdajs.com/docs/#contains|R.contains}
|
|
21
|
-
* @example
|
|
22
|
-
*
|
|
23
|
-
* RA.contained([1, 2, 3], 3); //=> true
|
|
24
|
-
* RA.contained([1, 2, 3], 4); //=> false
|
|
25
|
-
* RA.contained([{ name: 'Fred' }], { name: 'Fred' }); //=> true
|
|
26
|
-
* RA.contained([[42]], [42]); //=> true
|
|
27
|
-
*/
|
|
28
|
-
const contained = flip(contains);
|
|
29
|
-
|
|
30
|
-
export default contained;
|
package/src/hasPath.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { length, has, path, head, tail, curryN } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import isObj from './isObj';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Returns whether or not an object has an own property with the specified name at a given path.
|
|
7
|
-
*
|
|
8
|
-
* @func hasPath
|
|
9
|
-
* @memberOf RA
|
|
10
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/1.14.0|v1.14.0}
|
|
11
|
-
* @deprecated since v2.12.0; ramda@0.26.0 contains hasPath
|
|
12
|
-
* @category Object
|
|
13
|
-
* @typedef Idx = String | Int
|
|
14
|
-
* @sig [Idx] -> {a} -> Boolean
|
|
15
|
-
* @param {Array.<string|number>} path The path of the nested property
|
|
16
|
-
* @param {Object} obj The object to test
|
|
17
|
-
* @return {boolean}
|
|
18
|
-
* @see {@link http://ramdajs.com/docs/#has|R.has}
|
|
19
|
-
* @example
|
|
20
|
-
*
|
|
21
|
-
* RA.hasPath(['a', 'b'], { a: { b: 1 } }); //=> true
|
|
22
|
-
* RA.hasPath(['a', 'b', 'c'], { a: { b: 1 } }); //=> false
|
|
23
|
-
* RA.hasPath(['a', 'b'], { a: { } }); //=> false
|
|
24
|
-
* RA.hasPath([0], [1, 2]); //=> true
|
|
25
|
-
*/
|
|
26
|
-
const hasPath = curryN(2, (objPath, obj) => {
|
|
27
|
-
const prop = head(objPath);
|
|
28
|
-
|
|
29
|
-
// termination conditions
|
|
30
|
-
if (length(objPath) === 0 || !isObj(obj)) {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
if (length(objPath) === 1) {
|
|
34
|
-
return has(prop, obj);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return hasPath(tail(objPath), path([prop], obj)); // base case
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
export default hasPath;
|
package/src/mergeRight.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { merge, flip } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Create a new object with the own properties of the second object merged with
|
|
5
|
-
* the own properties of the first object. If a key exists in both objects,
|
|
6
|
-
* the value from the first object will be used. *
|
|
7
|
-
* Putting it simply: it sets properties only if they don't exist.
|
|
8
|
-
*
|
|
9
|
-
* @func mergeRight
|
|
10
|
-
* @deprecated since v2.12.0; available in ramda@0.26.0 as R.mergeLeft
|
|
11
|
-
* @aliases mergeLeft, resetToDefault
|
|
12
|
-
* @memberOf RA
|
|
13
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/1.6.0|v1.6.0}
|
|
14
|
-
* @category Object
|
|
15
|
-
* @sig {k: v} -> {k: v} -> {k: v}
|
|
16
|
-
* @param {Object} r Destination
|
|
17
|
-
* @param {Object} l Source
|
|
18
|
-
* @return {Object}
|
|
19
|
-
* @see {@link http://ramdajs.com/docs/#merge|R.merge}, {@link https://github.com/ramda/ramda/wiki/Cookbook#set-properties-only-if-they-dont-exist|Ramda Cookbook}
|
|
20
|
-
* @example
|
|
21
|
-
*
|
|
22
|
-
* RA.mergeRight({ 'age': 40 }, { 'name': 'fred', 'age': 10 });
|
|
23
|
-
* //=> { 'name': 'fred', 'age': 40 }
|
|
24
|
-
*/
|
|
25
|
-
const mergeRight = flip(merge);
|
|
26
|
-
|
|
27
|
-
export default mergeRight;
|
package/src/thenP.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { invoker } from 'ramda';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Composable shortcut for `Promise.then`.
|
|
5
|
-
* The thenP function returns a Promise. It takes two arguments: a callback function for the success of the Promise
|
|
6
|
-
* and the promise instance itself.
|
|
7
|
-
*
|
|
8
|
-
* @func thenP
|
|
9
|
-
* @memberOf RA
|
|
10
|
-
* @aliases then
|
|
11
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/2.8.0|v2.8.0}
|
|
12
|
-
* @deprecated since v2.12.0; available in ramda@0.26.0 as R.then
|
|
13
|
-
* @category Function
|
|
14
|
-
* @sig (a -> Promise b | b) -> Promise b
|
|
15
|
-
* @param {Function} onFulfilled A Function called if the Promise is fulfilled. This function has one argument, the fulfillment value
|
|
16
|
-
* @param {Promise} promise Any Promise or Thenable object
|
|
17
|
-
* @return {Promise} A Promise in the pending status
|
|
18
|
-
|
|
19
|
-
* @see {@link RA.resolveP|resolveP}, {@link RA.rejectP|rejectP}, {@link RA.allP|allP}
|
|
20
|
-
* @example
|
|
21
|
-
*
|
|
22
|
-
* const promise = Promise.resolve(1);
|
|
23
|
-
* const add1 = v => v + 1;
|
|
24
|
-
*
|
|
25
|
-
* RA.thenP(add1, promise); // => Promise(2)
|
|
26
|
-
*/
|
|
27
|
-
const thenP = invoker(1, 'then');
|
|
28
|
-
|
|
29
|
-
export default thenP;
|