ramda-adjunct 2.32.0 → 2.33.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 +10 -0
- package/README.md +3 -3
- package/dist/RA.node.js +232 -129
- package/dist/RA.node.min.js +1 -1
- package/dist/RA.web.js +232 -129
- package/dist/RA.web.min.js +1 -1
- package/dist/RA.web.standalone.js +232 -129
- package/dist/RA.web.standalone.min.js +1 -1
- package/es/catchP.js +24 -0
- package/es/dispatch.js +1 -1
- package/es/fantasy-land/Identity.js +61 -74
- 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 +3 -1
- package/es/internal/ap.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 +1 -1
- package/es/isSentinelValue.js +26 -0
- 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/lib/anyP.js +2 -2
- package/lib/catchP.js +30 -0
- package/lib/dispatch.js +1 -1
- package/lib/fantasy-land/Identity.js +65 -75
- package/lib/fantasy-land/mapping.js +41 -25
- package/lib/fantasy-land/traits.js +18 -12
- package/lib/flattenDepth.js +1 -1
- package/lib/index.js +11 -3
- package/lib/internal/ap.js +9 -3
- 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 +1 -1
- package/lib/isSentinelValue.js +35 -0
- package/lib/lastP.js +1 -1
- package/lib/reduceP.js +1 -1
- package/lib/reduceRightP.js +1 -1
- package/lib/sortByProps.js +1 -1
- package/package.json +24 -25
- package/src/catchP.js +25 -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 +2 -0
- package/src/internal/ap.js +1 -1
- package/src/internal/ponyfills/Promise.allSettled.js +4 -3
- package/src/isSentinelValue.js +26 -0
- package/types/index.d.ts +14 -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/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
|
|
|
@@ -5,18 +5,8 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
5
5
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); 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.
|
|
@@ -42,46 +32,12 @@ var of = fl.of,
|
|
|
42
32
|
*/
|
|
43
33
|
|
|
44
34
|
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
|
-
|
|
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,7 +268,38 @@ 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
|
|
|
@@ -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,6 +114,7 @@ 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';
|
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) {
|
|
@@ -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
|
|
|
@@ -6,7 +6,7 @@ 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
|
|
|
@@ -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/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 && (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 && (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
|
|
package/lib/anyP.js
CHANGED
|
@@ -13,9 +13,9 @@ var _Promise = _interopRequireWildcard(require("./internal/ponyfills/Promise.any
|
|
|
13
13
|
|
|
14
14
|
exports.AggregatedError = _Promise.AggregatedError;
|
|
15
15
|
|
|
16
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
17
|
|
|
18
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
21
|
|
package/lib/catchP.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = void 0;
|
|
5
|
+
|
|
6
|
+
var _ramda = require("ramda");
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Composable shortcut for `Promise.catch`.
|
|
10
|
+
* The catchP function returns a Promise. It takes two arguments: a callback function for the failure of the Promise
|
|
11
|
+
* and the promise instance itself.
|
|
12
|
+
*
|
|
13
|
+
* @func catchP
|
|
14
|
+
* @memberOf RA
|
|
15
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/2.29.0|v2.29.0}
|
|
16
|
+
* @category Function
|
|
17
|
+
* @sig (a -> Promise b | b) -> Promise b
|
|
18
|
+
* @param {Function} onRejected A Function called if the Promise is rejected. This function has one argument, the rejection reason.
|
|
19
|
+
* @param {Promise} promise Any Promise
|
|
20
|
+
* @return {Promise} Returns a Promise with dealt rejected cases
|
|
21
|
+
* @see {@link RA.thenP|thenP}, {@link RA.resolveP|resolveP}, {@link RA.rejectP|rejectP}, {@link RA.allP|allP}
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
*
|
|
25
|
+
* RA.catchP(() => 'b', Promise.resolve('a')); //=> Promise('a')
|
|
26
|
+
* RA.catchP(() => 'b', Promise.reject('a')); //=> Promise('b')
|
|
27
|
+
*/
|
|
28
|
+
var catchP = (0, _ramda.invoker)(1, 'catch');
|
|
29
|
+
var _default = catchP;
|
|
30
|
+
exports["default"] = _default;
|
package/lib/dispatch.js
CHANGED
|
@@ -19,7 +19,7 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
|
|
|
19
19
|
|
|
20
20
|
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); }
|
|
21
21
|
|
|
22
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator
|
|
22
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
23
23
|
|
|
24
24
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
25
25
|
|