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.
- package/CHANGELOG.md +55 -0
- package/README.md +3 -5
- package/dist/RA.node.js +854 -885
- package/dist/RA.node.min.js +1 -1
- package/dist/RA.web.js +854 -885
- package/dist/RA.web.min.js +1 -1
- package/dist/RA.web.standalone.js +6398 -5923
- package/dist/RA.web.standalone.min.js +1 -1
- package/es/copyKeys.js +34 -0
- package/es/fantasy-land/Identity.js +12 -12
- package/es/flattenPath.js +2 -2
- package/es/included.js +27 -0
- package/es/index.js +6 -11
- package/es/internal/isCoercible.js +6 -0
- package/es/internal/isOfTypeObject.js +1 -1
- package/es/internal/ponyfills/Promise.any.js +9 -5
- package/es/isArrayLike.js +1 -1
- package/es/isNotNilOrEmpty.js +1 -1
- package/es/isSymbol.js +1 -1
- package/es/mergePath.js +2 -3
- package/es/omitIndexes.js +2 -2
- package/es/pickIndexes.js +2 -2
- package/es/reduceP.js +1 -1
- package/es/reduceRightP.js +1 -1
- package/es/spreadPath.js +2 -2
- package/es/toNumber.js +22 -0
- package/es/trimCharsEnd.js +2 -2
- package/es/trimCharsStart.js +2 -2
- package/lib/anyP.js +1 -1
- package/lib/copyKeys.js +43 -0
- package/lib/fantasy-land/Identity.js +13 -13
- package/lib/fantasy-land/mapping.js +1 -1
- package/lib/fantasy-land/traits.js +2 -2
- package/lib/fantasy-land/util.js +1 -1
- package/lib/flattenPath.js +1 -1
- package/lib/included.js +33 -0
- package/lib/index.js +11 -19
- package/lib/internal/ap.js +1 -1
- package/lib/internal/isCoercible.js +18 -0
- package/lib/internal/isOfTypeObject.js +1 -1
- package/lib/internal/ponyfills/Promise.any.js +9 -5
- package/lib/isArrayLike.js +1 -1
- package/lib/isFinite.js +1 -1
- package/lib/isInteger.js +1 -1
- package/lib/isNaN.js +1 -1
- package/lib/isNotNilOrEmpty.js +1 -1
- package/lib/isSafeInteger.js +1 -1
- package/lib/isSymbol.js +1 -1
- package/lib/mergePath.js +1 -5
- package/lib/omitIndexes.js +1 -1
- package/lib/padCharsEnd.js +1 -1
- package/lib/padCharsStart.js +1 -1
- package/lib/pickIndexes.js +1 -1
- package/lib/reduceP.js +1 -1
- package/lib/reduceRightP.js +1 -1
- package/lib/repeatStr.js +1 -1
- package/lib/replaceAll.js +1 -1
- package/lib/sign.js +1 -1
- package/lib/spreadPath.js +1 -1
- package/lib/thenCatchP.js +1 -1
- package/lib/toArray.js +1 -1
- package/lib/toNumber.js +31 -0
- package/lib/trimCharsEnd.js +2 -2
- package/lib/trimCharsStart.js +2 -2
- package/lib/trimEnd.js +1 -1
- package/lib/trimStart.js +1 -1
- package/lib/trunc.js +1 -1
- package/package.json +38 -52
- package/src/copyKeys.js +31 -0
- package/src/flattenPath.js +4 -2
- package/src/included.js +28 -0
- package/src/index.js +5 -10
- package/src/internal/isCoercible.js +12 -0
- package/src/internal/ponyfills/Promise.any.js +1 -1
- package/src/isNotNilOrEmpty.js +1 -1
- package/src/mergePath.js +2 -4
- package/src/omitIndexes.js +2 -2
- package/src/pickIndexes.js +2 -2
- package/src/spreadPath.js +2 -2
- package/src/toNumber.js +24 -0
- package/src/trimCharsEnd.js +2 -2
- package/src/trimCharsStart.js +2 -2
- package/types/index.d.ts +16 -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/es/copyKeys.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
|
|
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
|
+
|
|
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
|
+
|
|
7
|
+
import { curryN } from 'ramda';
|
|
8
|
+
import renameKeys from './renameKeys';
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new object with the own properties of the provided object, and the
|
|
11
|
+
* keys copied according to the keysMap object as `{oldKey: newKey}`.
|
|
12
|
+
* When no key from the keysMap is found, then a shallow clone of an object is returned.
|
|
13
|
+
*
|
|
14
|
+
* Keep in mind that in the case of keys conflict is behaviour undefined and
|
|
15
|
+
* the result may vary between various JS engines!
|
|
16
|
+
*
|
|
17
|
+
* @func copyKeys
|
|
18
|
+
* @memberOf RA
|
|
19
|
+
* @category Object
|
|
20
|
+
* @sig {a: b} -> {a: *} -> {b: *}
|
|
21
|
+
* @param {!Object} keysMap
|
|
22
|
+
* @param {!Object} obj
|
|
23
|
+
* @return {!Object} New object with copied keys
|
|
24
|
+
* @see {@link RA.renameKeys|renameKeys}
|
|
25
|
+
* @example
|
|
26
|
+
*
|
|
27
|
+
* copyKeys({ a: 'b' }, { a: true }); //=> { a: true, b: true }
|
|
28
|
+
* copyKeys({ a: 'b' }, { a: true, b: false }); //=> { a: true, b: true }
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
var copyKeys = curryN(2, function (keysMap, obj) {
|
|
32
|
+
return _objectSpread(_objectSpread({}, obj), renameKeys(keysMap, obj));
|
|
33
|
+
});
|
|
34
|
+
export default copyKeys;
|
|
@@ -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';
|
|
@@ -31,7 +31,7 @@ import { applyTrait, functorTrait, setoidTrait, semigroupTrait, chainTrait, ordT
|
|
|
31
31
|
* @since {@link https://char0n.github.io/ramda-adjunct/1.8.0|v1.8.0}
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
|
-
var Identity = /*#__PURE__*/function () {
|
|
34
|
+
var Identity = /*#__PURE__*/function (_fl$of, _fl$ap, _fl$map, _fl$equals, _fl$concat, _fl$chain, _fl$lte, _fl$empty, _fl$contramap) {
|
|
35
35
|
/**
|
|
36
36
|
* Private constructor. Use {@link RA.Identity.of|Identity.of} instead.
|
|
37
37
|
*
|
|
@@ -73,7 +73,7 @@ var Identity = /*#__PURE__*/function () {
|
|
|
73
73
|
*/
|
|
74
74
|
|
|
75
75
|
}, {
|
|
76
|
-
key:
|
|
76
|
+
key: _fl$ap,
|
|
77
77
|
value: function value(applyWithFn) {
|
|
78
78
|
return applyTrait[fl.ap].call(this, applyWithFn);
|
|
79
79
|
}
|
|
@@ -95,7 +95,7 @@ var Identity = /*#__PURE__*/function () {
|
|
|
95
95
|
*/
|
|
96
96
|
|
|
97
97
|
}, {
|
|
98
|
-
key:
|
|
98
|
+
key: _fl$map,
|
|
99
99
|
value: function value(fn) {
|
|
100
100
|
return functorTrait[fl.map].call(this, fn);
|
|
101
101
|
}
|
|
@@ -121,7 +121,7 @@ var Identity = /*#__PURE__*/function () {
|
|
|
121
121
|
*/
|
|
122
122
|
|
|
123
123
|
}, {
|
|
124
|
-
key:
|
|
124
|
+
key: _fl$equals,
|
|
125
125
|
value: function value(setoid) {
|
|
126
126
|
return setoidTrait[fl.equals].call(this, setoid);
|
|
127
127
|
}
|
|
@@ -152,7 +152,7 @@ var Identity = /*#__PURE__*/function () {
|
|
|
152
152
|
*/
|
|
153
153
|
|
|
154
154
|
}, {
|
|
155
|
-
key:
|
|
155
|
+
key: _fl$concat,
|
|
156
156
|
value: function value(semigroup) {
|
|
157
157
|
return semigroupTrait[fl.concat].call(this, semigroup);
|
|
158
158
|
}
|
|
@@ -176,7 +176,7 @@ var Identity = /*#__PURE__*/function () {
|
|
|
176
176
|
*/
|
|
177
177
|
|
|
178
178
|
}, {
|
|
179
|
-
key:
|
|
179
|
+
key: _fl$chain,
|
|
180
180
|
value: function value(fn) {
|
|
181
181
|
return chainTrait[fl.chain].call(this, fn);
|
|
182
182
|
}
|
|
@@ -203,7 +203,7 @@ var Identity = /*#__PURE__*/function () {
|
|
|
203
203
|
*/
|
|
204
204
|
|
|
205
205
|
}, {
|
|
206
|
-
key:
|
|
206
|
+
key: _fl$lte,
|
|
207
207
|
value: function value(ord) {
|
|
208
208
|
return ordTrait[fl.lte].call(this, ord);
|
|
209
209
|
}
|
|
@@ -230,7 +230,7 @@ var Identity = /*#__PURE__*/function () {
|
|
|
230
230
|
*/
|
|
231
231
|
|
|
232
232
|
}, {
|
|
233
|
-
key:
|
|
233
|
+
key: _fl$empty,
|
|
234
234
|
value: function value() {
|
|
235
235
|
return this.constructor.of(emptyR(this.value));
|
|
236
236
|
}
|
|
@@ -257,7 +257,7 @@ var Identity = /*#__PURE__*/function () {
|
|
|
257
257
|
*/
|
|
258
258
|
|
|
259
259
|
}, {
|
|
260
|
-
key:
|
|
260
|
+
key: _fl$contramap,
|
|
261
261
|
value: function value(fn) {
|
|
262
262
|
var _this = this;
|
|
263
263
|
|
|
@@ -271,7 +271,7 @@ var Identity = /*#__PURE__*/function () {
|
|
|
271
271
|
return this[fl.contramap](fn);
|
|
272
272
|
}
|
|
273
273
|
}], [{
|
|
274
|
-
key:
|
|
274
|
+
key: _fl$of,
|
|
275
275
|
value:
|
|
276
276
|
/**
|
|
277
277
|
* Fantasy land {@link https://github.com/fantasyland/fantasy-land#applicative|Applicative} specification.
|
|
@@ -304,6 +304,6 @@ var Identity = /*#__PURE__*/function () {
|
|
|
304
304
|
}]);
|
|
305
305
|
|
|
306
306
|
return Identity;
|
|
307
|
-
}();
|
|
307
|
+
}(fl.of, fl.ap, fl.map, fl.equals, fl.concat, fl.chain, fl.lte, fl.empty, fl.contramap);
|
|
308
308
|
|
|
309
309
|
export default Identity;
|
package/es/flattenPath.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { pathOr, curry,
|
|
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
|
|
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
|
|
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
|
|
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';
|
|
@@ -119,8 +119,6 @@ export { default as noneP } from './noneP';
|
|
|
119
119
|
export { default as resolveP } from './resolveP';
|
|
120
120
|
export { default as rejectP } from './rejectP';
|
|
121
121
|
export { default as delayP } from './delayP';
|
|
122
|
-
export { default as thenP } from './thenP';
|
|
123
|
-
export { default as then } from './thenP';
|
|
124
122
|
export { default as thenCatchP } from './thenCatchP';
|
|
125
123
|
export { default as allSettledP } from './allSettledP';
|
|
126
124
|
export { default as Y } from './Y';
|
|
@@ -149,8 +147,7 @@ export { default as sliceTo } from './sliceTo';
|
|
|
149
147
|
export { default as omitIndexes } from './omitIndexes';
|
|
150
148
|
export { default as compact } from './compact';
|
|
151
149
|
export { default as appendFlipped } from './appendFlipped';
|
|
152
|
-
export { default as
|
|
153
|
-
export { default as included } from './contained';
|
|
150
|
+
export { default as included } from './included';
|
|
154
151
|
export { default as move } from './move';
|
|
155
152
|
export { default as lengthGt } from './lengthGt';
|
|
156
153
|
export { default as lengthLt } from './lengthLt';
|
|
@@ -178,9 +175,7 @@ export { default as paths } from './paths';
|
|
|
178
175
|
export { default as renameKeys } from './renameKeys';
|
|
179
176
|
export { default as renameKeysWith } from './renameKeysWith';
|
|
180
177
|
export { default as renameKeyWith } from './renameKeyWith';
|
|
181
|
-
export { default as
|
|
182
|
-
export { default as mergeLeft } from './mergeRight';
|
|
183
|
-
export { default as resetToDefault } from './mergeRight';
|
|
178
|
+
export { default as copyKeys } from './copyKeys';
|
|
184
179
|
export { default as mergeProps } from './mergeProps';
|
|
185
180
|
export { default as mergePaths } from './mergePaths';
|
|
186
181
|
export { default as mergeProp } from './mergeProp';
|
|
@@ -188,7 +183,6 @@ export { default as mergePath } from './mergePath';
|
|
|
188
183
|
export { default as omitBy } from './omitBy';
|
|
189
184
|
export { default as pathOrLazy } from './pathOrLazy';
|
|
190
185
|
export { default as viewOr } from './viewOr';
|
|
191
|
-
export { default as hasPath } from './hasPath';
|
|
192
186
|
export { default as spreadProp } from './spreadProp';
|
|
193
187
|
export { default as spreadPath } from './spreadPath';
|
|
194
188
|
export { default as flattenProp } from './flattenProp';
|
|
@@ -232,7 +226,8 @@ export { default as toInt32 } from './toInteger32'; // alias of toInteger32
|
|
|
232
226
|
|
|
233
227
|
export { default as toUinteger32 } from './toUinteger32';
|
|
234
228
|
export { default as toUint32 } from './toUinteger32'; // alias of to toUinteger32
|
|
235
|
-
|
|
229
|
+
|
|
230
|
+
export { default as toNumber } from './toNumber'; // String
|
|
236
231
|
|
|
237
232
|
export { default as replaceAll } from './replaceAll';
|
|
238
233
|
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";
|
|
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";
|
|
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,13 +12,17 @@ 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
|
|
|
21
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
25
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
22
26
|
|
|
23
27
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
24
28
|
|
|
@@ -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] :
|
|
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";
|
|
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/isNotNilOrEmpty.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { complement } from 'ramda';
|
|
2
2
|
import isNilOrEmpty from './isNilOrEmpty';
|
|
3
3
|
/**
|
|
4
|
-
* Returns `
|
|
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";
|
|
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),
|
|
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 {
|
|
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
|
|
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,
|
|
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
|
|
5
|
+
return includes(index, indexes);
|
|
6
6
|
});
|
|
7
7
|
/**
|
|
8
8
|
* Picks values from list by indexes.
|
package/es/reduceP.js
CHANGED
|
@@ -6,7 +6,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
6
6
|
|
|
7
7
|
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; }
|
|
8
8
|
|
|
9
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
10
|
|
|
11
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
12
|
|
package/es/reduceRightP.js
CHANGED
|
@@ -6,7 +6,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
6
6
|
|
|
7
7
|
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; }
|
|
8
8
|
|
|
9
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
10
|
|
|
11
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
12
|
|
package/es/spreadPath.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { curryN, converge,
|
|
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(
|
|
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;
|
package/es/trimCharsEnd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { curry, dropLastWhile, join, pipe, split } from 'ramda';
|
|
2
|
-
import
|
|
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(
|
|
20
|
+
return pipe(split(''), dropLastWhile(included(chars)), join(''))(value);
|
|
21
21
|
});
|
|
22
22
|
export default trimCharsEnd;
|
package/es/trimCharsStart.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { curry, dropWhile, join, pipe, split } from 'ramda';
|
|
2
|
-
import
|
|
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(
|
|
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";
|
|
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
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = void 0;
|
|
5
|
+
|
|
6
|
+
var _ramda = require("ramda");
|
|
7
|
+
|
|
8
|
+
var _renameKeys = _interopRequireDefault(require("./renameKeys"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
|
|
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
|
+
|
|
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
|
+
|
|
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
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new object with the own properties of the provided object, and the
|
|
20
|
+
* keys copied according to the keysMap object as `{oldKey: newKey}`.
|
|
21
|
+
* When no key from the keysMap is found, then a shallow clone of an object is returned.
|
|
22
|
+
*
|
|
23
|
+
* Keep in mind that in the case of keys conflict is behaviour undefined and
|
|
24
|
+
* the result may vary between various JS engines!
|
|
25
|
+
*
|
|
26
|
+
* @func copyKeys
|
|
27
|
+
* @memberOf RA
|
|
28
|
+
* @category Object
|
|
29
|
+
* @sig {a: b} -> {a: *} -> {b: *}
|
|
30
|
+
* @param {!Object} keysMap
|
|
31
|
+
* @param {!Object} obj
|
|
32
|
+
* @return {!Object} New object with copied keys
|
|
33
|
+
* @see {@link RA.renameKeys|renameKeys}
|
|
34
|
+
* @example
|
|
35
|
+
*
|
|
36
|
+
* copyKeys({ a: 'b' }, { a: true }); //=> { a: true, b: true }
|
|
37
|
+
* copyKeys({ a: 'b' }, { a: true, b: false }); //=> { a: true, b: true }
|
|
38
|
+
*/
|
|
39
|
+
var copyKeys = (0, _ramda.curryN)(2, function (keysMap, obj) {
|
|
40
|
+
return _objectSpread(_objectSpread({}, obj), (0, _renameKeys["default"])(keysMap, obj));
|
|
41
|
+
});
|
|
42
|
+
var _default = copyKeys;
|
|
43
|
+
exports["default"] = _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
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}
|
|
@@ -44,7 +44,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
44
44
|
* {@link https://github.com/fantasyland/fantasy-land#contravariant|Contravariant}
|
|
45
45
|
* @since {@link https://char0n.github.io/ramda-adjunct/1.8.0|v1.8.0}
|
|
46
46
|
*/
|
|
47
|
-
var Identity = /*#__PURE__*/function () {
|
|
47
|
+
var Identity = /*#__PURE__*/function (_fl$of, _fl$ap, _fl$map, _fl$equals, _fl$concat, _fl$chain, _fl$lte, _fl$empty, _fl$contramap) {
|
|
48
48
|
/**
|
|
49
49
|
* Private constructor. Use {@link RA.Identity.of|Identity.of} instead.
|
|
50
50
|
*
|
|
@@ -86,7 +86,7 @@ var Identity = /*#__PURE__*/function () {
|
|
|
86
86
|
*/
|
|
87
87
|
|
|
88
88
|
}, {
|
|
89
|
-
key:
|
|
89
|
+
key: _fl$ap,
|
|
90
90
|
value: function value(applyWithFn) {
|
|
91
91
|
return _traits.applyTrait[fl.ap].call(this, applyWithFn);
|
|
92
92
|
}
|
|
@@ -108,7 +108,7 @@ var Identity = /*#__PURE__*/function () {
|
|
|
108
108
|
*/
|
|
109
109
|
|
|
110
110
|
}, {
|
|
111
|
-
key:
|
|
111
|
+
key: _fl$map,
|
|
112
112
|
value: function value(fn) {
|
|
113
113
|
return _traits.functorTrait[fl.map].call(this, fn);
|
|
114
114
|
}
|
|
@@ -134,7 +134,7 @@ var Identity = /*#__PURE__*/function () {
|
|
|
134
134
|
*/
|
|
135
135
|
|
|
136
136
|
}, {
|
|
137
|
-
key:
|
|
137
|
+
key: _fl$equals,
|
|
138
138
|
value: function value(setoid) {
|
|
139
139
|
return _traits.setoidTrait[fl.equals].call(this, setoid);
|
|
140
140
|
}
|
|
@@ -165,7 +165,7 @@ var Identity = /*#__PURE__*/function () {
|
|
|
165
165
|
*/
|
|
166
166
|
|
|
167
167
|
}, {
|
|
168
|
-
key:
|
|
168
|
+
key: _fl$concat,
|
|
169
169
|
value: function value(semigroup) {
|
|
170
170
|
return _traits.semigroupTrait[fl.concat].call(this, semigroup);
|
|
171
171
|
}
|
|
@@ -189,7 +189,7 @@ var Identity = /*#__PURE__*/function () {
|
|
|
189
189
|
*/
|
|
190
190
|
|
|
191
191
|
}, {
|
|
192
|
-
key:
|
|
192
|
+
key: _fl$chain,
|
|
193
193
|
value: function value(fn) {
|
|
194
194
|
return _traits.chainTrait[fl.chain].call(this, fn);
|
|
195
195
|
}
|
|
@@ -216,7 +216,7 @@ var Identity = /*#__PURE__*/function () {
|
|
|
216
216
|
*/
|
|
217
217
|
|
|
218
218
|
}, {
|
|
219
|
-
key:
|
|
219
|
+
key: _fl$lte,
|
|
220
220
|
value: function value(ord) {
|
|
221
221
|
return _traits.ordTrait[fl.lte].call(this, ord);
|
|
222
222
|
}
|
|
@@ -243,7 +243,7 @@ var Identity = /*#__PURE__*/function () {
|
|
|
243
243
|
*/
|
|
244
244
|
|
|
245
245
|
}, {
|
|
246
|
-
key:
|
|
246
|
+
key: _fl$empty,
|
|
247
247
|
value: function value() {
|
|
248
248
|
return this.constructor.of((0, _ramda.empty)(this.value));
|
|
249
249
|
}
|
|
@@ -270,7 +270,7 @@ var Identity = /*#__PURE__*/function () {
|
|
|
270
270
|
*/
|
|
271
271
|
|
|
272
272
|
}, {
|
|
273
|
-
key:
|
|
273
|
+
key: _fl$contramap,
|
|
274
274
|
value: function value(fn) {
|
|
275
275
|
var _this = this;
|
|
276
276
|
|
|
@@ -284,7 +284,7 @@ var Identity = /*#__PURE__*/function () {
|
|
|
284
284
|
return this[fl.contramap](fn);
|
|
285
285
|
}
|
|
286
286
|
}], [{
|
|
287
|
-
key:
|
|
287
|
+
key: _fl$of,
|
|
288
288
|
value:
|
|
289
289
|
/**
|
|
290
290
|
* Fantasy land {@link https://github.com/fantasyland/fantasy-land#applicative|Applicative} specification.
|
|
@@ -317,7 +317,7 @@ var Identity = /*#__PURE__*/function () {
|
|
|
317
317
|
}]);
|
|
318
318
|
|
|
319
319
|
return Identity;
|
|
320
|
-
}();
|
|
320
|
+
}(fl.of, fl.ap, fl.map, fl.equals, fl.concat, fl.chain, fl.lte, fl.empty, fl.contramap);
|
|
321
321
|
|
|
322
322
|
var _default = Identity;
|
|
323
323
|
exports["default"] = _default;
|