ramda-adjunct 2.33.0 → 3.0.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.
Files changed (95) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +3 -5
  3. package/dist/RA.node.js +854 -885
  4. package/dist/RA.node.min.js +1 -1
  5. package/dist/RA.web.js +854 -885
  6. package/dist/RA.web.min.js +1 -1
  7. package/dist/RA.web.standalone.js +6398 -5923
  8. package/dist/RA.web.standalone.min.js +1 -1
  9. package/es/copyKeys.js +34 -0
  10. package/es/fantasy-land/Identity.js +12 -12
  11. package/es/flattenPath.js +2 -2
  12. package/es/included.js +27 -0
  13. package/es/index.js +6 -11
  14. package/es/internal/isCoercible.js +6 -0
  15. package/es/internal/isOfTypeObject.js +1 -1
  16. package/es/internal/ponyfills/Promise.any.js +9 -5
  17. package/es/isArrayLike.js +1 -1
  18. package/es/isNotNilOrEmpty.js +1 -1
  19. package/es/isSymbol.js +1 -1
  20. package/es/mergePath.js +2 -3
  21. package/es/omitIndexes.js +2 -2
  22. package/es/pickIndexes.js +2 -2
  23. package/es/reduceP.js +1 -1
  24. package/es/reduceRightP.js +1 -1
  25. package/es/spreadPath.js +2 -2
  26. package/es/toNumber.js +22 -0
  27. package/es/trimCharsEnd.js +2 -2
  28. package/es/trimCharsStart.js +2 -2
  29. package/lib/anyP.js +1 -1
  30. package/lib/copyKeys.js +43 -0
  31. package/lib/fantasy-land/Identity.js +13 -13
  32. package/lib/fantasy-land/mapping.js +1 -1
  33. package/lib/fantasy-land/traits.js +2 -2
  34. package/lib/fantasy-land/util.js +1 -1
  35. package/lib/flattenPath.js +1 -1
  36. package/lib/included.js +33 -0
  37. package/lib/index.js +11 -19
  38. package/lib/internal/ap.js +1 -1
  39. package/lib/internal/isCoercible.js +18 -0
  40. package/lib/internal/isOfTypeObject.js +1 -1
  41. package/lib/internal/ponyfills/Promise.any.js +9 -5
  42. package/lib/isArrayLike.js +1 -1
  43. package/lib/isFinite.js +1 -1
  44. package/lib/isInteger.js +1 -1
  45. package/lib/isNaN.js +1 -1
  46. package/lib/isNotNilOrEmpty.js +1 -1
  47. package/lib/isSafeInteger.js +1 -1
  48. package/lib/isSymbol.js +1 -1
  49. package/lib/mergePath.js +1 -5
  50. package/lib/omitIndexes.js +1 -1
  51. package/lib/padCharsEnd.js +1 -1
  52. package/lib/padCharsStart.js +1 -1
  53. package/lib/pickIndexes.js +1 -1
  54. package/lib/reduceP.js +1 -1
  55. package/lib/reduceRightP.js +1 -1
  56. package/lib/repeatStr.js +1 -1
  57. package/lib/replaceAll.js +1 -1
  58. package/lib/sign.js +1 -1
  59. package/lib/spreadPath.js +1 -1
  60. package/lib/thenCatchP.js +1 -1
  61. package/lib/toArray.js +1 -1
  62. package/lib/toNumber.js +31 -0
  63. package/lib/trimCharsEnd.js +2 -2
  64. package/lib/trimCharsStart.js +2 -2
  65. package/lib/trimEnd.js +1 -1
  66. package/lib/trimStart.js +1 -1
  67. package/lib/trunc.js +1 -1
  68. package/package.json +38 -52
  69. package/src/copyKeys.js +31 -0
  70. package/src/flattenPath.js +4 -2
  71. package/src/included.js +28 -0
  72. package/src/index.js +5 -10
  73. package/src/internal/isCoercible.js +12 -0
  74. package/src/internal/ponyfills/Promise.any.js +1 -1
  75. package/src/isNotNilOrEmpty.js +1 -1
  76. package/src/mergePath.js +2 -4
  77. package/src/omitIndexes.js +2 -2
  78. package/src/pickIndexes.js +2 -2
  79. package/src/spreadPath.js +2 -2
  80. package/src/toNumber.js +24 -0
  81. package/src/trimCharsEnd.js +2 -2
  82. package/src/trimCharsStart.js +2 -2
  83. package/types/index.d.ts +16 -34
  84. package/es/contained.js +0 -29
  85. package/es/hasPath.js +0 -38
  86. package/es/mergeRight.js +0 -26
  87. package/es/thenP.js +0 -28
  88. package/lib/contained.js +0 -35
  89. package/lib/hasPath.js +0 -47
  90. package/lib/mergeRight.js +0 -32
  91. package/lib/thenP.js +0 -34
  92. package/src/contained.js +0 -30
  93. package/src/hasPath.js +0 -40
  94. package/src/mergeRight.js +0 -27
  95. package/src/thenP.js +0 -29
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;