ramda-adjunct 2.35.0 → 3.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.
Files changed (96) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +2 -4
  3. package/dist/RA.node.js +275 -239
  4. package/dist/RA.node.min.js +1 -1
  5. package/dist/RA.web.js +275 -239
  6. package/dist/RA.web.min.js +1 -1
  7. package/dist/RA.web.standalone.js +6072 -5528
  8. package/dist/RA.web.standalone.min.js +1 -1
  9. package/es/copyKeys.js +2 -2
  10. package/es/fantasy-land/Identity.js +1 -1
  11. package/es/flattenPath.js +2 -2
  12. package/es/included.js +27 -0
  13. package/es/index.js +8 -12
  14. package/es/internal/isCoercible.js +6 -0
  15. package/es/internal/isOfTypeObject.js +1 -1
  16. package/es/internal/ponyfills/Promise.any.js +8 -4
  17. package/es/isArrayLike.js +1 -1
  18. package/es/isBlank.js +32 -0
  19. package/es/isNotNilOrEmpty.js +1 -1
  20. package/es/isSymbol.js +1 -1
  21. package/es/mergePath.js +2 -3
  22. package/es/omitIndexes.js +2 -2
  23. package/es/pickIndexes.js +2 -2
  24. package/es/sortByPaths.js +52 -0
  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 +2 -2
  31. package/lib/fantasy-land/Identity.js +2 -2
  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 +17 -21
  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 +8 -4
  42. package/lib/isArrayLike.js +1 -1
  43. package/lib/isBlank.js +41 -0
  44. package/lib/isFinite.js +1 -1
  45. package/lib/isInteger.js +1 -1
  46. package/lib/isNaN.js +1 -1
  47. package/lib/isNotNilOrEmpty.js +1 -1
  48. package/lib/isSafeInteger.js +1 -1
  49. package/lib/isSymbol.js +1 -1
  50. package/lib/mergePath.js +1 -5
  51. package/lib/omitIndexes.js +1 -1
  52. package/lib/padCharsEnd.js +1 -1
  53. package/lib/padCharsStart.js +1 -1
  54. package/lib/pickIndexes.js +1 -1
  55. package/lib/repeatStr.js +1 -1
  56. package/lib/replaceAll.js +1 -1
  57. package/lib/sign.js +1 -1
  58. package/lib/sortByPaths.js +59 -0
  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 +35 -50
  69. package/src/flattenPath.js +4 -2
  70. package/src/included.js +28 -0
  71. package/src/index.js +6 -10
  72. package/src/internal/isCoercible.js +12 -0
  73. package/src/internal/ponyfills/Promise.any.js +1 -1
  74. package/src/isBlank.js +33 -0
  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/sortByPaths.js +55 -0
  80. package/src/spreadPath.js +2 -2
  81. package/src/toNumber.js +24 -0
  82. package/src/trimCharsEnd.js +2 -2
  83. package/src/trimCharsStart.js +2 -2
  84. package/types/index.d.ts +20 -34
  85. package/es/contained.js +0 -29
  86. package/es/hasPath.js +0 -38
  87. package/es/mergeRight.js +0 -26
  88. package/es/thenP.js +0 -28
  89. package/lib/contained.js +0 -35
  90. package/lib/hasPath.js +0 -47
  91. package/lib/mergeRight.js +0 -32
  92. package/lib/thenP.js +0 -34
  93. package/src/contained.js +0 -30
  94. package/src/hasPath.js +0 -40
  95. package/src/mergeRight.js +0 -27
  96. package/src/thenP.js +0 -29
package/es/copyKeys.js CHANGED
@@ -1,6 +1,6 @@
1
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
1
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
2
 
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
4
 
5
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
 
@@ -2,7 +2,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
2
2
 
3
3
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
4
4
 
5
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
5
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
6
6
 
7
7
  import { empty as emptyR } from 'ramda';
8
8
  import * as fl from './mapping';
package/es/flattenPath.js CHANGED
@@ -1,4 +1,4 @@
1
- import { pathOr, curry, merge } from 'ramda';
1
+ import { pathOr, curry, mergeRight } from 'ramda';
2
2
  /**
3
3
  * Flattens a property path so that its fields are spread out into the provided object.
4
4
  * It's like {@link RA.spreadPath|spreadPath}, but preserves object under the property path.
@@ -22,6 +22,6 @@ import { pathOr, curry, merge } from 'ramda';
22
22
  */
23
23
 
24
24
  var flattenPath = curry(function (path, obj) {
25
- return merge(obj, pathOr({}, path, obj));
25
+ return mergeRight(obj, pathOr({}, path, obj));
26
26
  });
27
27
  export default flattenPath;
package/es/included.js ADDED
@@ -0,0 +1,27 @@
1
+ import { flip, includes } 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/#includes|R.includes} but with argument order reversed.
8
+ *
9
+ * @func included
10
+ * @memberOf RA
11
+ * @since {@link https://char0n.github.io/ramda-adjunct/3.0.0|v3.0.0}
12
+ * @category List
13
+ * @sig [a] -> a -> Boolean
14
+ * @param {Array|String} list The list to consider
15
+ * @param {*} a The item to compare against
16
+ * @return {boolean} Returns Boolean `true` if an equivalent item is in the list or `false` otherwise
17
+ * @see {@link http://ramdajs.com/docs/#includes|R.includes}
18
+ * @example
19
+ *
20
+ * RA.included([1, 2, 3], 3); //=> true
21
+ * RA.included([1, 2, 3], 4); //=> false
22
+ * RA.included([{ name: 'Fred' }], { name: 'Fred' }); //=> true
23
+ * RA.included([[42]], [42]); //=> true
24
+ */
25
+
26
+ var included = flip(includes);
27
+ export default included;
package/es/index.js CHANGED
@@ -28,7 +28,7 @@ export { default as isNotAsyncFunction } from './isNotAsyncFunction';
28
28
  export { default as isFunction } from './isFunction';
29
29
  export { default as isNotFunction } from './isNotFunction';
30
30
  export { default as isObj } from './isObj';
31
- export { default as isObject } from './isObj'; // alias of isObject
31
+ export { default as isObject } from './isObj'; // alias of isObj
32
32
 
33
33
  export { default as isNotObj } from './isNotObj';
34
34
  export { default as isNotObject } from './isNotObj'; // alias of isNotObj
@@ -42,7 +42,7 @@ export { default as isNotObjectLike } from './isNotObjLike'; // alias of isNotOb
42
42
  export { default as isPlainObj } from './isPlainObj';
43
43
  export { default as isPlainObject } from './isPlainObj';
44
44
  export { default as isNotPlainObj } from './isNotPlainObj';
45
- export { default as isNotPlainObject } from './isNotPlainObj'; // alias of isNotPlainObject
45
+ export { default as isNotPlainObject } from './isNotPlainObj'; // alias of isNotPlainObj
46
46
 
47
47
  export { default as isDate } from './isDate';
48
48
  export { default as isNotDate } from './isNotDate';
@@ -97,7 +97,8 @@ export { default as isError } from './isError';
97
97
  export { default as isNaturalNumber } from './isNaturalNumber';
98
98
  export { default as isPrimitive } from './isPrimitive';
99
99
  export { default as isNotPrimitive } from './isNotPrimitive';
100
- export { default as isSentinelValue } from './isSentinelValue'; // Function
100
+ export { default as isSentinelValue } from './isSentinelValue';
101
+ export { default as isBlank } from './isBlank'; // Function
101
102
 
102
103
  export { default as stubUndefined } from './stubUndefined';
103
104
  export { default as stubNull } from './stubNull';
@@ -119,8 +120,6 @@ export { default as noneP } from './noneP';
119
120
  export { default as resolveP } from './resolveP';
120
121
  export { default as rejectP } from './rejectP';
121
122
  export { default as delayP } from './delayP';
122
- export { default as thenP } from './thenP';
123
- export { default as then } from './thenP';
124
123
  export { default as thenCatchP } from './thenCatchP';
125
124
  export { default as allSettledP } from './allSettledP';
126
125
  export { default as Y } from './Y';
@@ -149,8 +148,7 @@ export { default as sliceTo } from './sliceTo';
149
148
  export { default as omitIndexes } from './omitIndexes';
150
149
  export { default as compact } from './compact';
151
150
  export { default as appendFlipped } from './appendFlipped';
152
- export { default as contained } from './contained';
153
- export { default as included } from './contained';
151
+ export { default as included } from './included';
154
152
  export { default as move } from './move';
155
153
  export { default as lengthGt } from './lengthGt';
156
154
  export { default as lengthLt } from './lengthLt';
@@ -168,6 +166,7 @@ export { default as toArray } from './toArray';
168
166
  export { default as allUnique } from './allUnique';
169
167
  export { default as notAllUnique } from './notAllUnique';
170
168
  export { default as sortByProps } from './sortByProps';
169
+ export { default as sortByPaths } from './sortByPaths';
171
170
  export { default as skipTake } from './skipTake';
172
171
  export { default as rangeStep } from './rangeStep';
173
172
  export { default as findOr } from './findOr'; // Object
@@ -179,9 +178,6 @@ export { default as renameKeys } from './renameKeys';
179
178
  export { default as renameKeysWith } from './renameKeysWith';
180
179
  export { default as renameKeyWith } from './renameKeyWith';
181
180
  export { default as copyKeys } from './copyKeys';
182
- export { default as mergeRight } from './mergeRight';
183
- export { default as mergeLeft } from './mergeRight';
184
- export { default as resetToDefault } from './mergeRight';
185
181
  export { default as mergeProps } from './mergeProps';
186
182
  export { default as mergePaths } from './mergePaths';
187
183
  export { default as mergeProp } from './mergeProp';
@@ -189,7 +185,6 @@ export { default as mergePath } from './mergePath';
189
185
  export { default as omitBy } from './omitBy';
190
186
  export { default as pathOrLazy } from './pathOrLazy';
191
187
  export { default as viewOr } from './viewOr';
192
- export { default as hasPath } from './hasPath';
193
188
  export { default as spreadProp } from './spreadProp';
194
189
  export { default as spreadPath } from './spreadPath';
195
190
  export { default as flattenProp } from './flattenProp';
@@ -233,7 +228,8 @@ export { default as toInt32 } from './toInteger32'; // alias of toInteger32
233
228
 
234
229
  export { default as toUinteger32 } from './toUinteger32';
235
230
  export { default as toUint32 } from './toUinteger32'; // alias of to toUinteger32
236
- // String
231
+
232
+ export { default as toNumber } from './toNumber'; // String
237
233
 
238
234
  export { default as replaceAll } from './replaceAll';
239
235
  export { default as escapeRegExp } from './escapeRegExp';
@@ -0,0 +1,6 @@
1
+ import { both, hasIn } from 'ramda';
2
+ import isObj from '../isObj';
3
+ import isSymbol from '../isSymbol';
4
+ import neither from '../neither';
5
+ var isCoercible = neither(isSymbol, both(isObj, neither(hasIn('toString'), hasIn('valueOf'))));
6
+ export default isCoercible;
@@ -1,4 +1,4 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
2
 
3
3
  var isOfTypeObject = function isOfTypeObject(val) {
4
4
  return _typeof(val) === 'object';
@@ -1,4 +1,4 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
2
 
3
3
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
4
 
@@ -12,9 +12,13 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
12
12
 
13
13
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
14
14
 
15
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
16
+
17
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
18
+
15
19
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16
20
 
17
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
21
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
18
22
 
19
23
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
20
24
 
@@ -45,7 +49,7 @@ export var AggregatedError = /*#__PURE__*/function (_Error) {
45
49
  var _this;
46
50
 
47
51
  var errors = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
48
- var message = arguments.length > 1 ? arguments[1] : undefined;
52
+ var message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
49
53
 
50
54
  _classCallCheck(this, AggregatedError);
51
55
 
@@ -54,7 +58,7 @@ export var AggregatedError = /*#__PURE__*/function (_Error) {
54
58
  return _this;
55
59
  }
56
60
 
57
- return AggregatedError;
61
+ return _createClass(AggregatedError);
58
62
  }( /*#__PURE__*/_wrapNativeSuper(Error));
59
63
 
60
64
  var anyPonyfill = function anyPonyfill(iterable) {
package/es/isArrayLike.js CHANGED
@@ -1,4 +1,4 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
2
 
3
3
  import { has, curryN } from 'ramda';
4
4
  import isArray from './isArray';
package/es/isBlank.js ADDED
@@ -0,0 +1,32 @@
1
+ import { isEmpty, isNil, anyPass, test } from 'ramda';
2
+ import isFalse from './isFalse';
3
+ /**
4
+ * Returns `true` if the given value is its type's empty value, `false`, `undefined`
5
+ * as well as strings containing only whitespace characters; `false` otherwise.
6
+ *
7
+ * @func isBlank
8
+ * @memberOf RA
9
+ * @since {@link https://char0n.github.io/ramda-adjunct/3.1.0|v3.1.0}
10
+ * @category Type
11
+ * @sig * -> Boolean
12
+ * @param {*} val The value to test
13
+ * @return {boolean}
14
+ * @see {@link https://blog.appsignal.com/2018/09/11/differences-between-nil-empty-blank-and-present.html|Differences Between #nil?, #empty?, #blank?, and #present?}
15
+ * @example
16
+ *
17
+ * RA.isBlank(''); //=> true
18
+ * RA.isBlank(' '); //=> true
19
+ * RA.isBlank('\t\n'); //=> true
20
+ * RA.isBlank({}); //=> true
21
+ * RA.isBlank(null); //=> true
22
+ * RA.isBlank(undefined); //=> true
23
+ * RA.isBlank([]); //=> true
24
+ * RA.isBlank(false); //=> true
25
+ * RA.isBlank('value'); //=> false
26
+ * RA.isBlank({ foo: 'foo' }); //=> false
27
+ * RA.isBlank([1, 2, 3]); //=> false
28
+ * RA.isBlank(true); //=> false
29
+ */
30
+
31
+ var isBlank = anyPass([isFalse, isNil, isEmpty, test(/^\s+$/gm)]);
32
+ export default isBlank;
@@ -1,7 +1,7 @@
1
1
  import { complement } from 'ramda';
2
2
  import isNilOrEmpty from './isNilOrEmpty';
3
3
  /**
4
- * Returns `true` if the given value is its type's empty value, `null` or `undefined`.
4
+ * Returns `false` if the given value is its type's empty value, `null` or `undefined`.
5
5
  *
6
6
  * @func isNotNilOrEmpty
7
7
  * @memberOf RA
package/es/isSymbol.js CHANGED
@@ -1,4 +1,4 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
2
 
3
3
  import { type, curryN } from 'ramda';
4
4
  /**
package/es/mergePath.js CHANGED
@@ -1,5 +1,4 @@
1
- import { curry, over, lensPath } from 'ramda';
2
- import mergeRight from './mergeRight';
1
+ import { curry, over, lensPath, mergeLeft } from 'ramda';
3
2
  /**
4
3
  * Create a new object with the own properties of the object under the `path`
5
4
  * merged with the own properties of the provided `source`.
@@ -25,6 +24,6 @@ import mergeRight from './mergeRight';
25
24
  */
26
25
 
27
26
  var mergePath = curry(function (path, source, obj) {
28
- return over(lensPath(path), mergeRight(source), obj);
27
+ return over(lensPath(path), mergeLeft(source), obj);
29
28
  });
30
29
  export default mergePath;
package/es/omitIndexes.js CHANGED
@@ -1,8 +1,8 @@
1
- import { contains, curry, addIndex, reject } from 'ramda'; // helpers
1
+ import { includes, curry, addIndex, reject } from 'ramda'; // helpers
2
2
 
3
3
  var rejectIndexed = addIndex(reject);
4
4
  var containsIndex = curry(function (indexes, val, index) {
5
- return contains(index, indexes);
5
+ return includes(index, indexes);
6
6
  });
7
7
  /**
8
8
  * Returns a partial copy of an array omitting the indexes specified.
package/es/pickIndexes.js CHANGED
@@ -1,8 +1,8 @@
1
- import { filter, addIndex, curry, contains } from 'ramda'; // helpers
1
+ import { filter, addIndex, curry, includes } from 'ramda'; // helpers
2
2
 
3
3
  var filterIndexed = addIndex(filter);
4
4
  var containsIndex = curry(function (indexes, val, index) {
5
- return contains(index, indexes);
5
+ return includes(index, indexes);
6
6
  });
7
7
  /**
8
8
  * Picks values from list by indexes.
@@ -0,0 +1,52 @@
1
+ import { ascend, identity, map, path, pipe, sortWith, useWith } from 'ramda';
2
+ var pathToAscendSort = pipe(path, ascend);
3
+ var mapPathsToAscendSort = map(pathToAscendSort);
4
+ /**
5
+ * Sort a list of objects by a list of paths (if first path value is equivalent, sort by second, etc).
6
+ *
7
+ * @func sortByPaths
8
+ * @memberOf RA
9
+ * @since {@link https://char0n.github.io/ramda-adjunct/3.1.0|v3.1.0}
10
+ * @category List
11
+ * @sig [[k]] -> [{k: v}] -> [{k: v}]
12
+ * @param {Array.<Array.<string>>} paths A list of paths in the list param to sort by
13
+ * @param {Array.<object>} list A list of objects to be sorted
14
+ * @return {Array.<object>} A new list sorted by the paths in the paths param
15
+ * @example
16
+ *
17
+ * const alice = {
18
+ * name: 'Alice',
19
+ * address: {
20
+ * street: 31,
21
+ * zipCode: 97777,
22
+ * },
23
+ * };
24
+ * const bob = {
25
+ * name: 'Bob',
26
+ * address: {
27
+ * street: 31,
28
+ * zipCode: 55555,
29
+ * },
30
+ * };
31
+ * const clara = {
32
+ * name: 'Clara',
33
+ * address: {
34
+ * street: 32,
35
+ * zipCode: 90210,
36
+ * },
37
+ * };
38
+ * const people = [clara, bob, alice]
39
+ *
40
+ * RA.sortByPaths([
41
+ * ['address', 'street'],
42
+ * ['address', 'zipCode'],
43
+ * ], people); // => [bob, alice, clara]
44
+ *
45
+ * RA.sortByPaths([
46
+ * ['address', 'zipCode'],
47
+ * ['address', 'street'],
48
+ * ], people); // => [bob, clara, alice]
49
+ */
50
+
51
+ var sortByPaths = useWith(sortWith, [mapPathsToAscendSort, identity]);
52
+ export default sortByPaths;
package/es/spreadPath.js CHANGED
@@ -1,4 +1,4 @@
1
- import { curryN, converge, merge, dissocPath, pathOr } from 'ramda';
1
+ import { curryN, converge, mergeRight, dissocPath, pathOr } from 'ramda';
2
2
  /**
3
3
  * Spreads object under property path onto provided object.
4
4
  * It's like {@link RA.flattenPath|flattenPath}, but removes object under the property path.
@@ -21,5 +21,5 @@ import { curryN, converge, merge, dissocPath, pathOr } from 'ramda';
21
21
  * ); // => { a: 1, c: 3, d: 4, b1: {} };
22
22
  */
23
23
 
24
- var spreadPath = curryN(2, converge(merge, [dissocPath, pathOr({})]));
24
+ var spreadPath = curryN(2, converge(mergeRight, [dissocPath, pathOr({})]));
25
25
  export default spreadPath;
package/es/toNumber.js ADDED
@@ -0,0 +1,22 @@
1
+ import { ifElse, always } from 'ramda';
2
+ import isCoercible from './internal/isCoercible';
3
+ /**
4
+ * Converts value to a number.
5
+ *
6
+ * @func toNumber
7
+ * @memberOf RA
8
+ * @since {@link https://char0n.github.io/ramda-adjunct/2.36.0|v2.36.0}
9
+ * @category Type
10
+ * @param {*} val The value to convert
11
+ * @return {Number}
12
+ * @example
13
+ *
14
+ * RA.toNumber(3.2); //=> 3.2
15
+ * RA.toNumber(Number.MIN_VALUE); //=> 5e-324
16
+ * RA.toNumber(Infinity); //=> Infinity
17
+ * RA.toNumber('3.2'); //=> 3.2
18
+ * RA.toNumber(Symbol('3.2')); //=> NaN
19
+ */
20
+
21
+ var toNumber = ifElse(isCoercible, Number, always(NaN));
22
+ export default toNumber;
@@ -1,5 +1,5 @@
1
1
  import { curry, dropLastWhile, join, pipe, split } from 'ramda';
2
- import contained from './contained';
2
+ import included from './included';
3
3
  /**
4
4
  * Removes specified characters from the end of a string.
5
5
  *
@@ -17,6 +17,6 @@ import contained from './contained';
17
17
  */
18
18
 
19
19
  var trimCharsEnd = curry(function (chars, value) {
20
- return pipe(split(''), dropLastWhile(contained(chars)), join(''))(value);
20
+ return pipe(split(''), dropLastWhile(included(chars)), join(''))(value);
21
21
  });
22
22
  export default trimCharsEnd;
@@ -1,5 +1,5 @@
1
1
  import { curry, dropWhile, join, pipe, split } from 'ramda';
2
- import contained from './contained';
2
+ import included from './included';
3
3
  /**
4
4
  * Removes specified characters from the beginning of a string.
5
5
  *
@@ -17,6 +17,6 @@ import contained from './contained';
17
17
  */
18
18
 
19
19
  var trimCharsStart = curry(function (chars, value) {
20
- return pipe(split(''), dropWhile(contained(chars)), join(''))(value);
20
+ return pipe(split(''), dropWhile(included(chars)), join(''))(value);
21
21
  });
22
22
  export default trimCharsStart;
package/lib/anyP.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  exports.__esModule = true;
6
6
  exports["default"] = exports.anyPPonyfill = void 0;
package/lib/copyKeys.js CHANGED
@@ -9,9 +9,9 @@ var _renameKeys = _interopRequireDefault(require("./renameKeys"));
9
9
 
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
11
 
12
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
12
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13
13
 
14
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
14
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
15
15
 
16
16
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
17
17
 
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  exports.__esModule = true;
6
6
  exports["default"] = void 0;
@@ -19,7 +19,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
19
19
 
20
20
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
21
21
 
22
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
22
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
23
23
 
24
24
  /**
25
25
  * The simplest {@link https://github.com/fantasyland/fantasy-land|fantasy-land}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.promap = exports.bimap = exports.extract = exports.extend = exports.chainRec = exports.chain = exports.traverse = exports.reduce = exports.zero = exports.alt = exports.of = exports.ap = exports.contramap = exports.map = exports.empty = exports.concat = exports.id = exports.compose = exports.lte = exports.equals = void 0;
4
+ exports.zero = exports.traverse = exports.reduce = exports.promap = exports.of = exports.map = exports.lte = exports.id = exports.extract = exports.extend = exports.equals = exports.empty = exports.contramap = exports.concat = exports.compose = exports.chainRec = exports.chain = exports.bimap = exports.ap = exports.alt = void 0;
5
5
  var equals = 'fantasy-land/equals';
6
6
  exports.equals = equals;
7
7
  var lte = 'fantasy-land/lte';
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  exports.__esModule = true;
6
- exports.ordTrait = exports.chainTrait = exports.semigroupTrait = exports.setoidTrait = exports.applyTrait = exports.functorTrait = void 0;
6
+ exports.setoidTrait = exports.semigroupTrait = exports.ordTrait = exports.functorTrait = exports.chainTrait = exports.applyTrait = void 0;
7
7
 
8
8
  var _ramda = require("ramda");
9
9
 
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.isNotSameType = exports.isSameType = exports.typeEquals = exports.type = void 0;
4
+ exports.typeEquals = exports.type = exports.isSameType = exports.isNotSameType = void 0;
5
5
 
6
6
  var _ramda = require("ramda");
7
7
 
@@ -27,7 +27,7 @@ var _ramda = require("ramda");
27
27
  * ); // => { a: 1, c: 3, d: 4, b1: { b2: { c: 3, d: 4 } } };
28
28
  */
29
29
  var flattenPath = (0, _ramda.curry)(function (path, obj) {
30
- return (0, _ramda.merge)(obj, (0, _ramda.pathOr)({}, path, obj));
30
+ return (0, _ramda.mergeRight)(obj, (0, _ramda.pathOr)({}, path, obj));
31
31
  });
32
32
  var _default = flattenPath;
33
33
  exports["default"] = _default;
@@ -0,0 +1,33 @@
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/#includes|R.includes} but with argument order reversed.
14
+ *
15
+ * @func included
16
+ * @memberOf RA
17
+ * @since {@link https://char0n.github.io/ramda-adjunct/3.0.0|v3.0.0}
18
+ * @category List
19
+ * @sig [a] -> a -> Boolean
20
+ * @param {Array|String} list The list to consider
21
+ * @param {*} a The item to compare against
22
+ * @return {boolean} Returns Boolean `true` if an equivalent item is in the list or `false` otherwise
23
+ * @see {@link http://ramdajs.com/docs/#includes|R.includes}
24
+ * @example
25
+ *
26
+ * RA.included([1, 2, 3], 3); //=> true
27
+ * RA.included([1, 2, 3], 4); //=> false
28
+ * RA.included([{ name: 'Fred' }], { name: 'Fred' }); //=> true
29
+ * RA.included([[42]], [42]); //=> true
30
+ */
31
+ var included = (0, _ramda.flip)(_ramda.includes);
32
+ var _default = included;
33
+ exports["default"] = _default;