ramda-adjunct 2.32.0 → 2.36.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/.nvmrc +1 -0
- package/CHANGELOG.md +35 -0
- package/README.md +4 -6
- package/dist/RA.node.js +1043 -818
- package/dist/RA.node.min.js +1 -1
- package/dist/RA.web.js +1043 -818
- package/dist/RA.web.min.js +1 -1
- package/dist/RA.web.standalone.js +1678 -1453
- package/dist/RA.web.standalone.min.js +1 -1
- package/es/catchP.js +24 -0
- package/es/copyKeys.js +34 -0
- package/es/dispatch.js +1 -1
- package/es/fantasy-land/Identity.js +64 -77
- package/es/fantasy-land/mapping.js +20 -23
- package/es/fantasy-land/traits.js +1 -1
- package/es/flattenDepth.js +1 -1
- package/es/index.js +8 -3
- package/es/internal/ap.js +1 -1
- package/es/internal/isCoercible.js +6 -0
- package/es/internal/isOfTypeObject.js +1 -1
- package/es/internal/ponyfills/Array.from.js +1 -1
- package/es/internal/ponyfills/Promise.allSettled.js +1 -1
- package/es/internal/ponyfills/Promise.any.js +10 -6
- package/es/isArrayLike.js +1 -1
- package/es/isNotNilOrEmpty.js +1 -1
- package/es/isSentinelValue.js +26 -0
- package/es/isSymbol.js +1 -1
- package/es/lastP.js +1 -1
- package/es/reduceP.js +1 -1
- package/es/reduceRightP.js +1 -1
- package/es/sortByProps.js +1 -1
- package/es/toNumber.js +22 -0
- package/lib/anyP.js +3 -3
- package/lib/catchP.js +30 -0
- package/lib/copyKeys.js +43 -0
- package/lib/dispatch.js +1 -1
- package/lib/fantasy-land/Identity.js +68 -78
- package/lib/fantasy-land/mapping.js +41 -25
- package/lib/fantasy-land/traits.js +19 -13
- package/lib/fantasy-land/util.js +1 -1
- package/lib/flattenDepth.js +1 -1
- package/lib/index.js +19 -3
- package/lib/internal/ap.js +9 -3
- package/lib/internal/isCoercible.js +18 -0
- package/lib/internal/isOfTypeObject.js +1 -1
- package/lib/internal/ponyfills/Array.from.js +1 -1
- package/lib/internal/ponyfills/Promise.allSettled.js +1 -1
- package/lib/internal/ponyfills/Promise.any.js +10 -6
- 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/isSentinelValue.js +35 -0
- package/lib/isSymbol.js +1 -1
- package/lib/lastP.js +1 -1
- package/lib/padCharsEnd.js +1 -1
- package/lib/padCharsStart.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/sortByProps.js +1 -1
- package/lib/thenCatchP.js +1 -1
- package/lib/toArray.js +1 -1
- package/lib/toNumber.js +31 -0
- package/lib/trimEnd.js +1 -1
- package/lib/trimStart.js +1 -1
- package/lib/trunc.js +1 -1
- package/package.json +40 -39
- package/src/catchP.js +25 -0
- package/src/copyKeys.js +31 -0
- package/src/fantasy-land/Identity.js +24 -27
- package/src/fantasy-land/mapping.js +20 -24
- package/src/fantasy-land/traits.js +1 -1
- package/src/index.js +5 -1
- package/src/internal/ap.js +1 -1
- package/src/internal/isCoercible.js +12 -0
- package/src/internal/ponyfills/Promise.allSettled.js +4 -3
- package/src/internal/ponyfills/Promise.any.js +1 -1
- package/src/isNotNilOrEmpty.js +1 -1
- package/src/isSentinelValue.js +26 -0
- package/src/toNumber.js +24 -0
- package/types/index.d.ts +27 -0
package/es/catchP.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { invoker } from 'ramda';
|
|
2
|
+
/**
|
|
3
|
+
* Composable shortcut for `Promise.catch`.
|
|
4
|
+
* The catchP function returns a Promise. It takes two arguments: a callback function for the failure of the Promise
|
|
5
|
+
* and the promise instance itself.
|
|
6
|
+
*
|
|
7
|
+
* @func catchP
|
|
8
|
+
* @memberOf RA
|
|
9
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/2.29.0|v2.29.0}
|
|
10
|
+
* @category Function
|
|
11
|
+
* @sig (a -> Promise b | b) -> Promise b
|
|
12
|
+
* @param {Function} onRejected A Function called if the Promise is rejected. This function has one argument, the rejection reason.
|
|
13
|
+
* @param {Promise} promise Any Promise
|
|
14
|
+
* @return {Promise} Returns a Promise with dealt rejected cases
|
|
15
|
+
* @see {@link RA.thenP|thenP}, {@link RA.resolveP|resolveP}, {@link RA.rejectP|rejectP}, {@link RA.allP|allP}
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
*
|
|
19
|
+
* RA.catchP(() => 'b', Promise.resolve('a')); //=> Promise('a')
|
|
20
|
+
* RA.catchP(() => 'b', Promise.reject('a')); //=> Promise('b')
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
var catchP = invoker(1, 'catch');
|
|
24
|
+
export default catchP;
|
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;
|
package/es/dispatch.js
CHANGED
|
@@ -4,7 +4,7 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
|
|
|
4
4
|
|
|
5
5
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
6
|
|
|
7
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator
|
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
8
|
|
|
9
9
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
10
|
|
|
@@ -2,21 +2,11 @@ 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
|
-
import fl from './mapping';
|
|
9
|
-
import { applyTrait, functorTrait, setoidTrait, semigroupTrait, chainTrait, ordTrait } from './traits';
|
|
10
|
-
|
|
11
|
-
var of = fl.of,
|
|
12
|
-
_ap = fl.ap,
|
|
13
|
-
_map = fl.map,
|
|
14
|
-
_equals = fl.equals,
|
|
15
|
-
_concat = fl.concat,
|
|
16
|
-
_chain = fl.chain,
|
|
17
|
-
_lte = fl.lte,
|
|
18
|
-
_empty = fl.empty,
|
|
19
|
-
_contramap = fl.contramap;
|
|
8
|
+
import * as fl from './mapping';
|
|
9
|
+
import { applyTrait, functorTrait, setoidTrait, semigroupTrait, chainTrait, ordTrait } from './traits';
|
|
20
10
|
/**
|
|
21
11
|
* The simplest {@link https://github.com/fantasyland/fantasy-land|fantasy-land}
|
|
22
12
|
* compatible monad which attaches no information to values.
|
|
@@ -41,47 +31,13 @@ var of = fl.of,
|
|
|
41
31
|
* @since {@link https://char0n.github.io/ramda-adjunct/1.8.0|v1.8.0}
|
|
42
32
|
*/
|
|
43
33
|
|
|
44
|
-
var Identity = /*#__PURE__*/function () {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
* @static
|
|
52
|
-
* @sig of :: Applicative f => a -> f a
|
|
53
|
-
* @param {*} value
|
|
54
|
-
* @returns {RA.Identity}
|
|
55
|
-
* @example
|
|
56
|
-
*
|
|
57
|
-
* const a = Identity.of(1); //=> Identity(1)
|
|
58
|
-
*/
|
|
59
|
-
value: function value(_value) {
|
|
60
|
-
return new Identity(_value);
|
|
61
|
-
}
|
|
62
|
-
}, {
|
|
63
|
-
key: "of",
|
|
64
|
-
value: function of(value) {
|
|
65
|
-
return new Identity(value);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* @static
|
|
69
|
-
*/
|
|
70
|
-
|
|
71
|
-
}, {
|
|
72
|
-
key: '@@type',
|
|
73
|
-
get: function get() {
|
|
74
|
-
return 'RA/Identity';
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Private constructor. Use {@link RA.Identity.of|Identity.of} instead.
|
|
78
|
-
*
|
|
79
|
-
* @param {*} value
|
|
80
|
-
* @return {RA.Identity}
|
|
81
|
-
*/
|
|
82
|
-
|
|
83
|
-
}]);
|
|
84
|
-
|
|
34
|
+
var Identity = /*#__PURE__*/function (_fl$of, _fl$ap, _fl$map, _fl$equals, _fl$concat, _fl$chain, _fl$lte, _fl$empty, _fl$contramap) {
|
|
35
|
+
/**
|
|
36
|
+
* Private constructor. Use {@link RA.Identity.of|Identity.of} instead.
|
|
37
|
+
*
|
|
38
|
+
* @param {*} value
|
|
39
|
+
* @return {RA.Identity}
|
|
40
|
+
*/
|
|
85
41
|
function Identity(value) {
|
|
86
42
|
_classCallCheck(this, Identity);
|
|
87
43
|
|
|
@@ -117,14 +73,14 @@ var Identity = /*#__PURE__*/function () {
|
|
|
117
73
|
*/
|
|
118
74
|
|
|
119
75
|
}, {
|
|
120
|
-
key:
|
|
76
|
+
key: _fl$ap,
|
|
121
77
|
value: function value(applyWithFn) {
|
|
122
|
-
return applyTrait[
|
|
78
|
+
return applyTrait[fl.ap].call(this, applyWithFn);
|
|
123
79
|
}
|
|
124
80
|
}, {
|
|
125
81
|
key: "ap",
|
|
126
82
|
value: function ap(applyWithFn) {
|
|
127
|
-
return this[
|
|
83
|
+
return this[fl.ap](applyWithFn);
|
|
128
84
|
}
|
|
129
85
|
/**
|
|
130
86
|
* Fantasy land {@link https://github.com/fantasyland/fantasy-land#functor|Functor} specification.
|
|
@@ -139,14 +95,14 @@ var Identity = /*#__PURE__*/function () {
|
|
|
139
95
|
*/
|
|
140
96
|
|
|
141
97
|
}, {
|
|
142
|
-
key:
|
|
98
|
+
key: _fl$map,
|
|
143
99
|
value: function value(fn) {
|
|
144
|
-
return functorTrait[
|
|
100
|
+
return functorTrait[fl.map].call(this, fn);
|
|
145
101
|
}
|
|
146
102
|
}, {
|
|
147
103
|
key: "map",
|
|
148
104
|
value: function map(fn) {
|
|
149
|
-
return this[
|
|
105
|
+
return this[fl.map](fn);
|
|
150
106
|
}
|
|
151
107
|
/**
|
|
152
108
|
* Fantasy land {@link https://github.com/fantasyland/fantasy-land#setoid|Setoid} specification.
|
|
@@ -165,14 +121,14 @@ var Identity = /*#__PURE__*/function () {
|
|
|
165
121
|
*/
|
|
166
122
|
|
|
167
123
|
}, {
|
|
168
|
-
key:
|
|
124
|
+
key: _fl$equals,
|
|
169
125
|
value: function value(setoid) {
|
|
170
|
-
return setoidTrait[
|
|
126
|
+
return setoidTrait[fl.equals].call(this, setoid);
|
|
171
127
|
}
|
|
172
128
|
}, {
|
|
173
129
|
key: "equals",
|
|
174
130
|
value: function equals(setoid) {
|
|
175
|
-
return this[
|
|
131
|
+
return this[fl.equals](setoid);
|
|
176
132
|
}
|
|
177
133
|
/**
|
|
178
134
|
* Fantasy land {@link https://github.com/fantasyland/fantasy-land#semigroup|Semigroup} specification.
|
|
@@ -196,14 +152,14 @@ var Identity = /*#__PURE__*/function () {
|
|
|
196
152
|
*/
|
|
197
153
|
|
|
198
154
|
}, {
|
|
199
|
-
key:
|
|
155
|
+
key: _fl$concat,
|
|
200
156
|
value: function value(semigroup) {
|
|
201
|
-
return semigroupTrait[
|
|
157
|
+
return semigroupTrait[fl.concat].call(this, semigroup);
|
|
202
158
|
}
|
|
203
159
|
}, {
|
|
204
160
|
key: "concat",
|
|
205
161
|
value: function concat(semigroup) {
|
|
206
|
-
return this[
|
|
162
|
+
return this[fl.concat](semigroup);
|
|
207
163
|
}
|
|
208
164
|
/**
|
|
209
165
|
* Fantasy land {@link https://github.com/fantasyland/fantasy-land#chain|Chain} specification.
|
|
@@ -220,14 +176,14 @@ var Identity = /*#__PURE__*/function () {
|
|
|
220
176
|
*/
|
|
221
177
|
|
|
222
178
|
}, {
|
|
223
|
-
key:
|
|
179
|
+
key: _fl$chain,
|
|
224
180
|
value: function value(fn) {
|
|
225
|
-
return chainTrait[
|
|
181
|
+
return chainTrait[fl.chain].call(this, fn);
|
|
226
182
|
}
|
|
227
183
|
}, {
|
|
228
184
|
key: "chain",
|
|
229
185
|
value: function chain(fn) {
|
|
230
|
-
return this[
|
|
186
|
+
return this[fl.chain](fn);
|
|
231
187
|
}
|
|
232
188
|
/**
|
|
233
189
|
* Fantasy land {@link https://github.com/fantasyland/fantasy-land#ord|Ord} specification.
|
|
@@ -247,14 +203,14 @@ var Identity = /*#__PURE__*/function () {
|
|
|
247
203
|
*/
|
|
248
204
|
|
|
249
205
|
}, {
|
|
250
|
-
key:
|
|
206
|
+
key: _fl$lte,
|
|
251
207
|
value: function value(ord) {
|
|
252
|
-
return ordTrait[
|
|
208
|
+
return ordTrait[fl.lte].call(this, ord);
|
|
253
209
|
}
|
|
254
210
|
}, {
|
|
255
211
|
key: "lte",
|
|
256
212
|
value: function lte(ord) {
|
|
257
|
-
return this[
|
|
213
|
+
return this[fl.lte](ord);
|
|
258
214
|
}
|
|
259
215
|
/**
|
|
260
216
|
* Fantasy land {@link https://github.com/fantasyland/fantasy-land#monoid|Monoid*} specification.
|
|
@@ -274,14 +230,14 @@ var Identity = /*#__PURE__*/function () {
|
|
|
274
230
|
*/
|
|
275
231
|
|
|
276
232
|
}, {
|
|
277
|
-
key:
|
|
233
|
+
key: _fl$empty,
|
|
278
234
|
value: function value() {
|
|
279
235
|
return this.constructor.of(emptyR(this.value));
|
|
280
236
|
}
|
|
281
237
|
}, {
|
|
282
238
|
key: "empty",
|
|
283
239
|
value: function empty() {
|
|
284
|
-
return this[
|
|
240
|
+
return this[fl.empty]();
|
|
285
241
|
}
|
|
286
242
|
/**
|
|
287
243
|
* Fantasy land {@link https://github.com/fantasyland/fantasy-land#contravariant|Contravariant} specification.
|
|
@@ -301,7 +257,7 @@ var Identity = /*#__PURE__*/function () {
|
|
|
301
257
|
*/
|
|
302
258
|
|
|
303
259
|
}, {
|
|
304
|
-
key:
|
|
260
|
+
key: _fl$contramap,
|
|
305
261
|
value: function value(fn) {
|
|
306
262
|
var _this = this;
|
|
307
263
|
|
|
@@ -312,11 +268,42 @@ var Identity = /*#__PURE__*/function () {
|
|
|
312
268
|
}, {
|
|
313
269
|
key: "contramap",
|
|
314
270
|
value: function contramap(fn) {
|
|
315
|
-
return this[
|
|
271
|
+
return this[fl.contramap](fn);
|
|
272
|
+
}
|
|
273
|
+
}], [{
|
|
274
|
+
key: _fl$of,
|
|
275
|
+
value:
|
|
276
|
+
/**
|
|
277
|
+
* Fantasy land {@link https://github.com/fantasyland/fantasy-land#applicative|Applicative} specification.
|
|
278
|
+
*
|
|
279
|
+
* @static
|
|
280
|
+
* @sig of :: Applicative f => a -> f a
|
|
281
|
+
* @param {*} value
|
|
282
|
+
* @returns {RA.Identity}
|
|
283
|
+
* @example
|
|
284
|
+
*
|
|
285
|
+
* const a = Identity.of(1); //=> Identity(1)
|
|
286
|
+
*/
|
|
287
|
+
function value(_value) {
|
|
288
|
+
return new Identity(_value);
|
|
289
|
+
}
|
|
290
|
+
}, {
|
|
291
|
+
key: "of",
|
|
292
|
+
value: function of(value) {
|
|
293
|
+
return new Identity(value);
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* @static
|
|
297
|
+
*/
|
|
298
|
+
|
|
299
|
+
}, {
|
|
300
|
+
key: '@@type',
|
|
301
|
+
get: function get() {
|
|
302
|
+
return 'RA/Identity';
|
|
316
303
|
}
|
|
317
304
|
}]);
|
|
318
305
|
|
|
319
306
|
return Identity;
|
|
320
|
-
}();
|
|
307
|
+
}(fl.of, fl.ap, fl.map, fl.equals, fl.concat, fl.chain, fl.lte, fl.empty, fl.contramap);
|
|
321
308
|
|
|
322
309
|
export default Identity;
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
promap: 'fantasy-land/promap'
|
|
22
|
-
});
|
|
23
|
-
export default mapping;
|
|
1
|
+
export var equals = 'fantasy-land/equals';
|
|
2
|
+
export var lte = 'fantasy-land/lte';
|
|
3
|
+
export var compose = 'fantasy-land/compose';
|
|
4
|
+
export var id = 'fantasy-land/id';
|
|
5
|
+
export var concat = 'fantasy-land/concat';
|
|
6
|
+
export var empty = 'fantasy-land/empty';
|
|
7
|
+
export var map = 'fantasy-land/map';
|
|
8
|
+
export var contramap = 'fantasy-land/contramap';
|
|
9
|
+
export var ap = 'fantasy-land/ap';
|
|
10
|
+
export var of = 'fantasy-land/of';
|
|
11
|
+
export var alt = 'fantasy-land/alt';
|
|
12
|
+
export var zero = 'fantasy-land/zero';
|
|
13
|
+
export var reduce = 'fantasy-land/reduce';
|
|
14
|
+
export var traverse = 'fantasy-land/traverse';
|
|
15
|
+
export var chain = 'fantasy-land/chain';
|
|
16
|
+
export var chainRec = 'fantasy-land/chainRec';
|
|
17
|
+
export var extend = 'fantasy-land/extend';
|
|
18
|
+
export var extract = 'fantasy-land/extract';
|
|
19
|
+
export var bimap = 'fantasy-land/bimap';
|
|
20
|
+
export var promap = 'fantasy-land/promap';
|
|
@@ -5,7 +5,7 @@ import isString from '../isString';
|
|
|
5
5
|
import isNumber from '../isNumber';
|
|
6
6
|
import isFunction from '../isFunction';
|
|
7
7
|
import { isSameType } from './util';
|
|
8
|
-
import fl from './mapping';
|
|
8
|
+
import * as fl from './mapping';
|
|
9
9
|
export var functorTrait = _defineProperty({}, fl.map, function (fn) {
|
|
10
10
|
return this.constructor[fl.of](fn(this.value));
|
|
11
11
|
});
|
package/es/flattenDepth.js
CHANGED
|
@@ -4,7 +4,7 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
|
|
|
4
4
|
|
|
5
5
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
6
|
|
|
7
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator
|
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
8
|
|
|
9
9
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
10
|
|
package/es/index.js
CHANGED
|
@@ -96,7 +96,8 @@ export { default as isIndexed } from './isIndexed';
|
|
|
96
96
|
export { default as isError } from './isError';
|
|
97
97
|
export { default as isNaturalNumber } from './isNaturalNumber';
|
|
98
98
|
export { default as isPrimitive } from './isPrimitive';
|
|
99
|
-
export { default as isNotPrimitive } from './isNotPrimitive';
|
|
99
|
+
export { default as isNotPrimitive } from './isNotPrimitive';
|
|
100
|
+
export { default as isSentinelValue } from './isSentinelValue'; // Function
|
|
100
101
|
|
|
101
102
|
export { default as stubUndefined } from './stubUndefined';
|
|
102
103
|
export { default as stubNull } from './stubNull';
|
|
@@ -113,12 +114,14 @@ export { default as weaveLazy } from './weaveLazy';
|
|
|
113
114
|
export { default as curryRightN } from './curryRightN';
|
|
114
115
|
export { default as curryRight } from './curryRight';
|
|
115
116
|
export { default as allP } from './allP';
|
|
117
|
+
export { default as catchP } from './catchP';
|
|
116
118
|
export { default as noneP } from './noneP';
|
|
117
119
|
export { default as resolveP } from './resolveP';
|
|
118
120
|
export { default as rejectP } from './rejectP';
|
|
119
121
|
export { default as delayP } from './delayP';
|
|
120
122
|
export { default as thenP } from './thenP';
|
|
121
|
-
export { default as then } from './thenP';
|
|
123
|
+
export { default as then } from './thenP'; // eslint-disable-line no-restricted-exports
|
|
124
|
+
|
|
122
125
|
export { default as thenCatchP } from './thenCatchP';
|
|
123
126
|
export { default as allSettledP } from './allSettledP';
|
|
124
127
|
export { default as Y } from './Y';
|
|
@@ -176,6 +179,7 @@ export { default as paths } from './paths';
|
|
|
176
179
|
export { default as renameKeys } from './renameKeys';
|
|
177
180
|
export { default as renameKeysWith } from './renameKeysWith';
|
|
178
181
|
export { default as renameKeyWith } from './renameKeyWith';
|
|
182
|
+
export { default as copyKeys } from './copyKeys';
|
|
179
183
|
export { default as mergeRight } from './mergeRight';
|
|
180
184
|
export { default as mergeLeft } from './mergeRight';
|
|
181
185
|
export { default as resetToDefault } from './mergeRight';
|
|
@@ -230,7 +234,8 @@ export { default as toInt32 } from './toInteger32'; // alias of toInteger32
|
|
|
230
234
|
|
|
231
235
|
export { default as toUinteger32 } from './toUinteger32';
|
|
232
236
|
export { default as toUint32 } from './toUinteger32'; // alias of to toUinteger32
|
|
233
|
-
|
|
237
|
+
|
|
238
|
+
export { default as toNumber } from './toNumber'; // String
|
|
234
239
|
|
|
235
240
|
export { default as replaceAll } from './replaceAll';
|
|
236
241
|
export { default as escapeRegExp } from './escapeRegExp';
|
package/es/internal/ap.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ap as apR, curryN, pathSatisfies, both, either } from 'ramda';
|
|
2
2
|
import isFunction from '../isFunction';
|
|
3
|
-
import fl from '../fantasy-land/mapping';
|
|
3
|
+
import * as fl from '../fantasy-land/mapping';
|
|
4
4
|
var isFunctor = either(pathSatisfies(isFunction, ['map']), pathSatisfies(isFunction, [fl.map]));
|
|
5
5
|
var isApply = both(isFunctor, either(pathSatisfies(isFunction, ['ap']), pathSatisfies(isFunction, [fl.ap])));
|
|
6
6
|
var ap = curryN(2, function (applyF, applyX) {
|
|
@@ -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';
|
|
@@ -4,7 +4,7 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
|
|
|
4
4
|
|
|
5
5
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
6
|
|
|
7
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator
|
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
8
|
|
|
9
9
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
|
|
|
4
4
|
|
|
5
5
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
6
|
|
|
7
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator
|
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
8
|
|
|
9
9
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
10
|
|
|
@@ -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
|
|
|
@@ -6,19 +6,23 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
|
|
|
6
6
|
|
|
7
7
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
8
|
|
|
9
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator
|
|
9
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
10
10
|
|
|
11
11
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
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
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { curryN } from 'ramda';
|
|
2
|
+
import isInteger32 from './isInteger32';
|
|
3
|
+
/**
|
|
4
|
+
* Checks whether the passed value is {@link https://github.com/getify/You-Dont-Know-JS/blob/9959fc904d584bbf0b02cf41c192f74ff4238581/types-grammar/ch4.md#the-curious-case-of-the-|a sentinel value}.
|
|
5
|
+
*
|
|
6
|
+
* @func isSentinelValue
|
|
7
|
+
* @memberOf RA
|
|
8
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/2.33.0|v2.33.0}
|
|
9
|
+
* @category Type
|
|
10
|
+
* @sig * -> Boolean
|
|
11
|
+
* @param {*} val The value to test
|
|
12
|
+
* @return {boolean}
|
|
13
|
+
* @example
|
|
14
|
+
*
|
|
15
|
+
* RA.isSentinelValue(-1); //=> true
|
|
16
|
+
*
|
|
17
|
+
* RA.isSentinelValue('-1'); //=> false
|
|
18
|
+
* RA.isSentinelValue(1); //=> false
|
|
19
|
+
* RA.isSentinelValue([-1]); //=> false
|
|
20
|
+
*/
|
|
21
|
+
// eslint-disable-next-line no-bitwise
|
|
22
|
+
|
|
23
|
+
var isSentinelValue = curryN(1, function (val) {
|
|
24
|
+
return isInteger32(val) && ~val === 0;
|
|
25
|
+
});
|
|
26
|
+
export default isSentinelValue;
|
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/lastP.js
CHANGED
|
@@ -4,7 +4,7 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
|
|
|
4
4
|
|
|
5
5
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
6
|
|
|
7
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator
|
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
8
|
|
|
9
9
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
10
|
|
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) {
|
|
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) {
|
|
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/sortByProps.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 _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator
|
|
9
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
10
10
|
|
|
11
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
12
|
|