ramda-adjunct 2.31.1 → 2.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/.nvmrc +1 -0
  2. package/CHANGELOG.md +48 -0
  3. package/README.md +3 -3
  4. package/dist/RA.node.js +1144 -797
  5. package/dist/RA.node.min.js +1 -1
  6. package/dist/RA.web.js +1144 -797
  7. package/dist/RA.web.min.js +1 -1
  8. package/dist/RA.web.standalone.js +1782 -1435
  9. package/dist/RA.web.standalone.min.js +1 -1
  10. package/es/catchP.js +24 -0
  11. package/es/copyKeys.js +34 -0
  12. package/es/dispatch.js +1 -1
  13. package/es/fantasy-land/Identity.js +63 -76
  14. package/es/fantasy-land/mapping.js +20 -23
  15. package/es/fantasy-land/traits.js +1 -1
  16. package/es/findOr.js +28 -0
  17. package/es/flattenDepth.js +1 -1
  18. package/es/index.js +11 -2
  19. package/es/internal/ap.js +1 -1
  20. package/es/internal/ponyfills/Array.from.js +1 -1
  21. package/es/internal/ponyfills/Promise.allSettled.js +1 -1
  22. package/es/internal/ponyfills/Promise.any.js +3 -3
  23. package/es/isInteger32.js +28 -0
  24. package/es/isNotPrimitive.js +22 -0
  25. package/es/isPrimitive.js +31 -0
  26. package/es/isSentinelValue.js +26 -0
  27. package/es/lastP.js +1 -1
  28. package/es/reduceP.js +1 -1
  29. package/es/reduceRightP.js +1 -1
  30. package/es/sortByProps.js +1 -1
  31. package/lib/anyP.js +2 -2
  32. package/lib/catchP.js +30 -0
  33. package/lib/copyKeys.js +43 -0
  34. package/lib/dispatch.js +1 -1
  35. package/lib/fantasy-land/Identity.js +67 -77
  36. package/lib/fantasy-land/mapping.js +41 -25
  37. package/lib/fantasy-land/traits.js +18 -12
  38. package/lib/findOr.js +34 -0
  39. package/lib/flattenDepth.js +1 -1
  40. package/lib/index.js +32 -3
  41. package/lib/internal/ap.js +9 -3
  42. package/lib/internal/ponyfills/Array.from.js +1 -1
  43. package/lib/internal/ponyfills/Promise.allSettled.js +1 -1
  44. package/lib/internal/ponyfills/Promise.any.js +3 -3
  45. package/lib/isInteger32.js +37 -0
  46. package/lib/isNotPrimitive.js +31 -0
  47. package/lib/isPrimitive.js +47 -0
  48. package/lib/isSentinelValue.js +35 -0
  49. package/lib/lastP.js +1 -1
  50. package/lib/reduceP.js +1 -1
  51. package/lib/reduceRightP.js +1 -1
  52. package/lib/sortByProps.js +1 -1
  53. package/package.json +35 -35
  54. package/src/catchP.js +25 -0
  55. package/src/copyKeys.js +31 -0
  56. package/src/fantasy-land/Identity.js +24 -27
  57. package/src/fantasy-land/mapping.js +20 -24
  58. package/src/fantasy-land/traits.js +1 -1
  59. package/src/findOr.js +30 -0
  60. package/src/index.js +8 -0
  61. package/src/internal/ap.js +1 -1
  62. package/src/internal/ponyfills/Promise.allSettled.js +4 -3
  63. package/src/isInteger32.js +28 -0
  64. package/src/isNotPrimitive.js +25 -0
  65. package/src/isPrimitive.js +45 -0
  66. package/src/isSentinelValue.js +26 -0
  67. package/types/index.d.ts +55 -1
  68. package/.husky/commit-msg +0 -4
  69. package/.husky/pre-commit +0 -4
  70. package/.mocharc.js +0 -9
@@ -1,6 +1,6 @@
1
1
  import { empty as emptyR } from 'ramda';
2
2
 
3
- import fl from './mapping';
3
+ import * as fl from './mapping';
4
4
  import {
5
5
  applyTrait,
6
6
  functorTrait,
@@ -10,9 +10,6 @@ import {
10
10
  ordTrait,
11
11
  } from './traits';
12
12
 
13
- // we do this here for jsdocs generate properly
14
- const { of, ap, map, equals, concat, chain, lte, empty, contramap } = fl;
15
-
16
13
  /**
17
14
  * The simplest {@link https://github.com/fantasyland/fantasy-land|fantasy-land}
18
15
  * compatible monad which attaches no information to values.
@@ -48,7 +45,7 @@ class Identity {
48
45
  *
49
46
  * const a = Identity.of(1); //=> Identity(1)
50
47
  */
51
- static [of](value) {
48
+ static [fl.of](value) {
52
49
  return new Identity(value);
53
50
  }
54
51
 
@@ -98,12 +95,12 @@ class Identity {
98
95
  *
99
96
  * a.ap(b); //=> Identity(2)
100
97
  */
101
- [ap](applyWithFn) {
102
- return applyTrait[ap].call(this, applyWithFn);
98
+ [fl.ap](applyWithFn) {
99
+ return applyTrait[fl.ap].call(this, applyWithFn);
103
100
  }
104
101
 
105
102
  ap(applyWithFn) {
106
- return this[ap](applyWithFn);
103
+ return this[fl.ap](applyWithFn);
107
104
  }
108
105
 
109
106
  /**
@@ -117,12 +114,12 @@ class Identity {
117
114
  * const a = Identity.of(1);
118
115
  * a.map(a => a + 1); //=> Identity(2)
119
116
  */
120
- [map](fn) {
121
- return functorTrait[map].call(this, fn);
117
+ [fl.map](fn) {
118
+ return functorTrait[fl.map].call(this, fn);
122
119
  }
123
120
 
124
121
  map(fn) {
125
- return this[map](fn);
122
+ return this[fl.map](fn);
126
123
  }
127
124
 
128
125
  /**
@@ -140,12 +137,12 @@ class Identity {
140
137
  * a.equals(b); //=> true
141
138
  * a.equals(c); //=> false
142
139
  */
143
- [equals](setoid) {
144
- return setoidTrait[equals].call(this, setoid);
140
+ [fl.equals](setoid) {
141
+ return setoidTrait[fl.equals].call(this, setoid);
145
142
  }
146
143
 
147
144
  equals(setoid) {
148
- return this[equals](setoid);
145
+ return this[fl.equals](setoid);
149
146
  }
150
147
 
151
148
  /**
@@ -168,12 +165,12 @@ class Identity {
168
165
  * const f = Identity.of(['f']);
169
166
  * e.concat(f); //=> ['e', 'f']
170
167
  */
171
- [concat](semigroup) {
172
- return semigroupTrait[concat].call(this, semigroup);
168
+ [fl.concat](semigroup) {
169
+ return semigroupTrait[fl.concat].call(this, semigroup);
173
170
  }
174
171
 
175
172
  concat(semigroup) {
176
- return this[concat](semigroup);
173
+ return this[fl.concat](semigroup);
177
174
  }
178
175
 
179
176
  /**
@@ -189,12 +186,12 @@ class Identity {
189
186
  *
190
187
  * a.chain(fn).chain(fn); //=> Identity(3)
191
188
  */
192
- [chain](fn) {
193
- return chainTrait[chain].call(this, fn);
189
+ [fl.chain](fn) {
190
+ return chainTrait[fl.chain].call(this, fn);
194
191
  }
195
192
 
196
193
  chain(fn) {
197
- return this[chain](fn);
194
+ return this[fl.chain](fn);
198
195
  }
199
196
 
200
197
  /**
@@ -213,12 +210,12 @@ class Identity {
213
210
  * a.lte(c); //=> true
214
211
  * c.lte(a); //=> false
215
212
  */
216
- [lte](ord) {
217
- return ordTrait[lte].call(this, ord);
213
+ [fl.lte](ord) {
214
+ return ordTrait[fl.lte].call(this, ord);
218
215
  }
219
216
 
220
217
  lte(ord) {
221
- return this[lte](ord);
218
+ return this[fl.lte](ord);
222
219
  }
223
220
 
224
221
  /**
@@ -237,12 +234,12 @@ class Identity {
237
234
  * a.concat(i); //=> Identity('string');
238
235
  * i.concat(a); //=> Identity('string');
239
236
  */
240
- [empty]() {
237
+ [fl.empty]() {
241
238
  return this.constructor.of(emptyR(this.value));
242
239
  }
243
240
 
244
241
  empty() {
245
- return this[empty]();
242
+ return this[fl.empty]();
246
243
  }
247
244
 
248
245
  /**
@@ -261,12 +258,12 @@ class Identity {
261
258
  * Identity.of(identity).contramap(divide2).contramap(add1).get()(3); //=> 2
262
259
  * Identity.of(identity).contramap(a => divide2(add1(a))).get()(3); //=> 2
263
260
  */
264
- [contramap](fn) {
261
+ [fl.contramap](fn) {
265
262
  return this.constructor.of((value) => this.value(fn(value)));
266
263
  }
267
264
 
268
265
  contramap(fn) {
269
- return this[contramap](fn);
266
+ return this[fl.contramap](fn);
270
267
  }
271
268
  }
272
269
 
@@ -1,24 +1,20 @@
1
- const mapping = Object.freeze({
2
- equals: 'fantasy-land/equals',
3
- lte: 'fantasy-land/lte',
4
- compose: 'fantasy-land/compose',
5
- id: 'fantasy-land/id',
6
- concat: 'fantasy-land/concat',
7
- empty: 'fantasy-land/empty',
8
- map: 'fantasy-land/map',
9
- contramap: 'fantasy-land/contramap',
10
- ap: 'fantasy-land/ap',
11
- of: 'fantasy-land/of',
12
- alt: 'fantasy-land/alt',
13
- zero: 'fantasy-land/zero',
14
- reduce: 'fantasy-land/reduce',
15
- traverse: 'fantasy-land/traverse',
16
- chain: 'fantasy-land/chain',
17
- chainRec: 'fantasy-land/chainRec',
18
- extend: 'fantasy-land/extend',
19
- extract: 'fantasy-land/extract',
20
- bimap: 'fantasy-land/bimap',
21
- promap: 'fantasy-land/promap',
22
- });
23
-
24
- export default mapping;
1
+ export const equals = 'fantasy-land/equals';
2
+ export const lte = 'fantasy-land/lte';
3
+ export const compose = 'fantasy-land/compose';
4
+ export const id = 'fantasy-land/id';
5
+ export const concat = 'fantasy-land/concat';
6
+ export const empty = 'fantasy-land/empty';
7
+ export const map = 'fantasy-land/map';
8
+ export const contramap = 'fantasy-land/contramap';
9
+ export const ap = 'fantasy-land/ap';
10
+ export const of = 'fantasy-land/of';
11
+ export const alt = 'fantasy-land/alt';
12
+ export const zero = 'fantasy-land/zero';
13
+ export const reduce = 'fantasy-land/reduce';
14
+ export const traverse = 'fantasy-land/traverse';
15
+ export const chain = 'fantasy-land/chain';
16
+ export const chainRec = 'fantasy-land/chainRec';
17
+ export const extend = 'fantasy-land/extend';
18
+ export const extract = 'fantasy-land/extract';
19
+ export const bimap = 'fantasy-land/bimap';
20
+ export const promap = 'fantasy-land/promap';
@@ -4,7 +4,7 @@ import isString from '../isString';
4
4
  import isNumber from '../isNumber';
5
5
  import isFunction from '../isFunction';
6
6
  import { isSameType } from './util';
7
- import fl from './mapping';
7
+ import * as fl from './mapping';
8
8
 
9
9
  export const functorTrait = {
10
10
  [fl.map](fn) {
package/src/findOr.js ADDED
@@ -0,0 +1,30 @@
1
+ import { pipe, curry, find, defaultTo } from 'ramda';
2
+
3
+ /**
4
+ * Returns the first element of the list which matches the predicate.
5
+ * Returns default value if no element matches or matched element is `null`, `undefined` or `NaN`.
6
+ * Dispatches to the find method of the second argument, if present.
7
+ * Acts as a transducer if a transformer is given in list position.
8
+ *
9
+ * @func findOr
10
+ * @memberOf RA
11
+ * @since {@link https://char0n.github.io/ramda-adjunct/2.32.0|v2.32.0}
12
+ * @category List
13
+ * @sig a -> (b -> Boolean) -> [b] -> b | a
14
+ * @param {*} defaultValue The default value
15
+ * @param {Function} fn The predicate function used to determine if the element is the desired one.
16
+ * @param {Array} list The array to consider.
17
+ * @return {*} The element found, or the default value.
18
+ * @see {@link http://ramdajs.com/docs/#defaultTo|R.defaultTo}, {@link http://ramdajs.com/docs/#find|R.find}
19
+ * @example
20
+ *
21
+ * RA.findOr(1, isUndefined, [1, 2, undefined]); // => 1
22
+ * RA.findOr(1, val => val === 2, [1, 2, undefined]); // => 2
23
+ * RA.findOr(1, val => val === 3, [1, 2, undefined]); // => 1
24
+ */
25
+
26
+ const findOr = curry((defaultVal, fn, list) =>
27
+ pipe(find(fn), defaultTo(defaultVal))(list)
28
+ );
29
+
30
+ export default findOr;
package/src/index.js CHANGED
@@ -61,6 +61,8 @@ export { default as isNotNaN } from './isNotNaN';
61
61
  export { default as isFinite } from './isFinite';
62
62
  export { default as isNotFinite } from './isNotFinite';
63
63
  export { default as isInteger } from './isInteger';
64
+ export { default as isInteger32 } from './isInteger32';
65
+ export { default as isInt32 } from './isInteger32'; // alias of isInteger32
64
66
  export { default as isNotInteger } from './isNotInteger';
65
67
  export { default as isBigInt } from './isBigInt';
66
68
  export { default as isFloat } from './isFloat';
@@ -87,6 +89,9 @@ export { default as isSafeInteger } from './isSafeInteger';
87
89
  export { default as isIndexed } from './isIndexed';
88
90
  export { default as isError } from './isError';
89
91
  export { default as isNaturalNumber } from './isNaturalNumber';
92
+ export { default as isPrimitive } from './isPrimitive';
93
+ export { default as isNotPrimitive } from './isNotPrimitive';
94
+ export { default as isSentinelValue } from './isSentinelValue';
90
95
  // Function
91
96
  export { default as stubUndefined } from './stubUndefined';
92
97
  export { default as stubNull } from './stubNull';
@@ -103,6 +108,7 @@ export { default as weaveLazy } from './weaveLazy';
103
108
  export { default as curryRightN } from './curryRightN';
104
109
  export { default as curryRight } from './curryRight';
105
110
  export { default as allP } from './allP';
111
+ export { default as catchP } from './catchP';
106
112
  export { default as noneP } from './noneP';
107
113
  export { default as resolveP } from './resolveP';
108
114
  export { default as rejectP } from './rejectP';
@@ -157,6 +163,7 @@ export { default as notAllUnique } from './notAllUnique';
157
163
  export { default as sortByProps } from './sortByProps';
158
164
  export { default as skipTake } from './skipTake';
159
165
  export { default as rangeStep } from './rangeStep';
166
+ export { default as findOr } from './findOr';
160
167
  // Object
161
168
  export { default as invoke } from './invoke';
162
169
  export { default as invokeArgs } from './invokeArgs';
@@ -164,6 +171,7 @@ export { default as paths } from './paths';
164
171
  export { default as renameKeys } from './renameKeys';
165
172
  export { default as renameKeysWith } from './renameKeysWith';
166
173
  export { default as renameKeyWith } from './renameKeyWith';
174
+ export { default as copyKeys } from './copyKeys';
167
175
  export { default as mergeRight } from './mergeRight';
168
176
  export { default as mergeLeft } from './mergeRight';
169
177
  export { default as resetToDefault } from './mergeRight';
@@ -1,7 +1,7 @@
1
1
  import { ap as apR, curryN, pathSatisfies, both, either } from 'ramda';
2
2
 
3
3
  import isFunction from '../isFunction';
4
- import fl from '../fantasy-land/mapping';
4
+ import * as fl from '../fantasy-land/mapping';
5
5
 
6
6
  const isFunctor = either(
7
7
  pathSatisfies(isFunction, ['map']),
@@ -7,9 +7,10 @@ const onFulfill = (value) => ({ status: 'fulfilled', value });
7
7
  const onReject = (reason) => ({ status: 'rejected', reason });
8
8
 
9
9
  const allSettledPonyfill = (iterable) => {
10
- const array = map((p) => resolveP(p).then(onFulfill).catch(onReject), [
11
- ...iterable,
12
- ]);
10
+ const array = map(
11
+ (p) => resolveP(p).then(onFulfill).catch(onReject),
12
+ [...iterable]
13
+ );
13
14
 
14
15
  return allP(array);
15
16
  };
@@ -0,0 +1,28 @@
1
+ import { curryN } from 'ramda';
2
+
3
+ import toInteger32 from './toInteger32';
4
+
5
+ /**
6
+ * Checks whether the passed value is a signed 32 bit integer.
7
+ *
8
+ * @func isInteger32
9
+ * @aliases isInt32
10
+ * @memberOf RA
11
+ * @since {@link https://char0n.github.io/ramda-adjunct/2.32.0|v2.32.0}
12
+ * @category Type
13
+ * @sig * -> Boolean
14
+ * @param {*} val The value to test
15
+ * @return {boolean}
16
+ * @see {@link RA.toInteger32|toInteger32}
17
+ * @example
18
+ *
19
+ * RA.isInteger32(0); //=> true
20
+ * RA.isInteger32((-2) ** 31); //=> true
21
+ *
22
+ * RA.isInteger32(Infinity); //=> false
23
+ * RA.isInteger32(NaN); //=> false
24
+ * RA.isInteger32(2 ** 31); //=> false
25
+ */
26
+ const isInteger32 = curryN(1, (val) => toInteger32(val) === val);
27
+
28
+ export default isInteger32;
@@ -0,0 +1,25 @@
1
+ import { complement, curryN } from 'ramda';
2
+
3
+ import isPrimitive from './isPrimitive';
4
+
5
+ /**
6
+ * Checks if value is not a primitive data type. There are 6 primitive data types: `string`, `number`, `bigint`, `boolean`, `undefined`, `symbol` and a special case of `null`.
7
+ *
8
+ * @func isNotPrimitive
9
+ * @category Type
10
+ * @sig * -> Boolean
11
+ * @since {@link https://char0n.github.io/ramda-adjunct/2.32.0|v2.32.0}
12
+ * @param {*} val The value to test
13
+ * @return {boolean}
14
+ * @see {@link RA.isPrimitive|isPrimitive}, {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#primitive_values|MDN Primitive values}, {@link https://developer.mozilla.org/en-US/docs/Glossary/Primitive|MDN Primitive}
15
+ * @example
16
+ *
17
+ * RA.isNotPrimitive(new String("string")); //=> true
18
+ * RA.isNotPrimitive(new Number(1)); //=> true
19
+ * RA.isNotPrimitive("string"); //=> false
20
+ * RA.isNotPrimitive(1); //=> false
21
+ */
22
+
23
+ const isNotPrimitive = curryN(1, complement(isPrimitive));
24
+
25
+ export default isNotPrimitive;
@@ -0,0 +1,45 @@
1
+ import { both, anyPass } from 'ramda';
2
+
3
+ import isNotObj from './isNotObj';
4
+ import isString from './isString';
5
+ import isNumber from './isNumber';
6
+ import isBigInt from './isBigInt';
7
+ import isBoolean from './isBoolean';
8
+ import isUndefined from './isUndefined';
9
+ import isNull from './isNull';
10
+ import isSymbol from './isSymbol';
11
+
12
+ /**
13
+ * Checks if value is a primitive data type. There are 6 primitive data types: `string`, `number`, `bigint`, `boolean`, `undefined`, `symbol` and a special case of `null`.
14
+ * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Primitive_values
15
+ * for definition of what sub-types comprise a primitive.
16
+ *
17
+ * @func isPrimitive
18
+ * @category Type
19
+ * @sig * -> Boolean
20
+ * @since {@link https://char0n.github.io/ramda-adjunct/2.32.0|v2.32.0}
21
+ * @param {*} val The value to test
22
+ * @return {boolean}
23
+ * @see {@link RA.isNotPrimitive|isNotPrimitive}, {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#primitive_values|MDN Primitive values}, {@link https://developer.mozilla.org/en-US/docs/Glossary/Primitive|MDN Primitive}
24
+ * @example
25
+ *
26
+ * RA.isPrimitive("string"); //=> true
27
+ * RA.isPrimitive(1); //=> true
28
+ * RA.isPrimitive(new String("string")); //=> false
29
+ * RA.isPrimitive(new Number(1)); //=> false
30
+ */
31
+
32
+ const isPrimitive = both(
33
+ isNotObj,
34
+ anyPass([
35
+ isString,
36
+ isNumber,
37
+ isBigInt,
38
+ isBoolean,
39
+ isUndefined,
40
+ isNull,
41
+ isSymbol,
42
+ ])
43
+ );
44
+
45
+ export default isPrimitive;
@@ -0,0 +1,26 @@
1
+ import { curryN } from 'ramda';
2
+
3
+ import isInteger32 from './isInteger32';
4
+
5
+ /**
6
+ * 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}.
7
+ *
8
+ * @func isSentinelValue
9
+ * @memberOf RA
10
+ * @since {@link https://char0n.github.io/ramda-adjunct/2.33.0|v2.33.0}
11
+ * @category Type
12
+ * @sig * -> Boolean
13
+ * @param {*} val The value to test
14
+ * @return {boolean}
15
+ * @example
16
+ *
17
+ * RA.isSentinelValue(-1); //=> true
18
+ *
19
+ * RA.isSentinelValue('-1'); //=> false
20
+ * RA.isSentinelValue(1); //=> false
21
+ * RA.isSentinelValue([-1]); //=> false
22
+ */
23
+ // eslint-disable-next-line no-bitwise
24
+ const isSentinelValue = curryN(1, (val) => isInteger32(val) && ~val === 0);
25
+
26
+ export default isSentinelValue;
package/types/index.d.ts CHANGED
@@ -44,6 +44,7 @@ declare namespace RamdaAdjunct {
44
44
  interface Dictionary<T> { [key: string]: T; }
45
45
 
46
46
  type DictPred<T> = (value: T, key: string) => boolean;
47
+ type Primitive = string | number | bigint | boolean | undefined | null | symbol;
47
48
 
48
49
  interface Static {
49
50
  /**
@@ -66,6 +67,18 @@ declare namespace RamdaAdjunct {
66
67
  */
67
68
  isBoolean(val: any): val is boolean;
68
69
 
70
+ /**
71
+ * Checks if value is a primitive data type. There are 6 primitive data types: `string`, `number`, `bigint`, `boolean`, `undefined`, `symbol` and a special case of `null`.
72
+ * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Primitive_values
73
+ * for definition of what sub-types comprise a primitive.
74
+ */
75
+ isPrimitive<T>(val: T | Primitive): val is Primitive;
76
+
77
+ /**
78
+ * Checks if value is not a primitive data type. There are 6 primitive data types: `string`, `number`, `bigint`, `boolean`, `undefined`, `symbol` and a special case of `null`.
79
+ */
80
+ isNotPrimitive<T>(val: T | Primitive): val is T;
81
+
69
82
  /**
70
83
  * Checks if an object exists in another object's prototype chain.
71
84
  */
@@ -105,7 +118,8 @@ declare namespace RamdaAdjunct {
105
118
  /**
106
119
  * Checks if input value is complement of `null` or `undefined`.
107
120
  */
108
- isNotNil(val: any): boolean;
121
+ /* tslint:disable-next-line:no-null-undefined-union null or undefined is the accurate type here */
122
+ isNotNil<T>(val: T | null | undefined): val is T;
109
123
 
110
124
  /**
111
125
  * Checks if input value is complement of `null`.
@@ -341,6 +355,11 @@ declare namespace RamdaAdjunct {
341
355
  */
342
356
  isInteger(val: any): val is number;
343
357
 
358
+ /**
359
+ * Checks whether the passed value is a signed 32 bit `integer`.
360
+ */
361
+ isInteger32(val: any): boolean;
362
+
344
363
  /**
345
364
  * Checks whether the passed value is complement of `integer`.
346
365
  */
@@ -436,6 +455,12 @@ declare namespace RamdaAdjunct {
436
455
  */
437
456
  isSparseArray(val: any): boolean;
438
457
 
458
+ /**
459
+ * Checks whether the passed value is
460
+ * {@link https://github.com/getify/You-Dont-Know-JS/blob/9959fc904d584bbf0b02cf41c192f74ff4238581/types-grammar/ch4.md#the-curious-case-of-the-|a sentinel value}.
461
+ */
462
+ isSentinelValue(val: any): boolean;
463
+
439
464
  /**
440
465
  * A function that returns `undefined`.
441
466
  */
@@ -569,6 +594,14 @@ declare namespace RamdaAdjunct {
569
594
  renameKeys(keysMap: Dictionary<string>, obj: object): object;
570
595
  renameKeys(keysMap: Dictionary<string>): (obj: object) => object;
571
596
 
597
+ /**
598
+ * Creates a new object with the own properties of the provided object, and the
599
+ * keys copied according to the keysMap object as `{oldKey: newKey}`.
600
+ * When no key from the keysMap is found, then a shallow clone of an object is returned.
601
+ */
602
+ copyKeys(keysMap: Dictionary<string>, obj: object): object;
603
+ copyKeys(keysMap: Dictionary<string>): (obj: object) => object;
604
+
572
605
  /**
573
606
  * Creates a new object with the own properties of the provided object, but the
574
607
  * keys renamed according to logic of renaming function.
@@ -977,6 +1010,14 @@ declare namespace RamdaAdjunct {
977
1010
  reject<T>(options: { timeout: number, value: T }): Promise<T>
978
1011
  };
979
1012
 
1013
+ /**
1014
+ * Composable shortcut for `Promise.catch`.
1015
+ * The catchP function returns a Promise. It takes two arguments: a callback function for the rejections of the Promise
1016
+ * and the promise instance itself.
1017
+ */
1018
+ catchP<A, B = unknown>(onRejected: (error: any) => B | Promise<B>, promise: Promise<A>): Promise<A | B>;
1019
+ catchP<A, B = unknown>(onRejected: (error: any) => B | Promise<B>): (promise: Promise<A>) => Promise<A | B>;
1020
+
980
1021
  /**
981
1022
  * Composable shortcut for `Promise.then`.
982
1023
  * The thenP function returns a Promise. It takes two arguments: a callback function for the success of the Promise
@@ -1157,6 +1198,19 @@ declare namespace RamdaAdjunct {
1157
1198
  defaultWhen<DefVal, Val>(predicate: Function, defaultVal: DefVal): (val: Val) => DefVal | Val;
1158
1199
  defaultWhen(predicate: Function): <DefVal, Val>(defaultVal: DefVal) => (val: Val) => DefVal | Val;
1159
1200
 
1201
+ /**
1202
+ * Returns the first element of the list which matches the predicate.
1203
+ * Returns default value if no element matches or matched element is `null`, `undefined` or `NaN`.
1204
+ * Dispatches to the find method of the second argument, if present.
1205
+ * Acts as a transducer if a transformer is given in list position.
1206
+ */
1207
+ findOr<DefVal, T>(defaultVal: DefVal, predicate: (element: T) => boolean, list: ReadonlyArray<T>): T | DefVal;
1208
+ findOr<DefVal, T>(defaultVal: DefVal, predicate: (element: T) => boolean): (list: ReadonlyArray<T>) => T | DefVal;
1209
+ findOr<DefVal, T>(defaultVal: DefVal): {
1210
+ (predicate: (element: T) => boolean, list: ReadonlyArray<T>): T | DefVal;
1211
+ (predicate: (element: T) => boolean): (list: ReadonlyArray<T>) => T | DefVal;
1212
+ };
1213
+
1160
1214
  /**
1161
1215
  * Y-combinator
1162
1216
  *
package/.husky/commit-msg DELETED
@@ -1,4 +0,0 @@
1
- #!/bin/sh
2
- . "$(dirname "$0")/_/husky.sh"
3
-
4
- commitlint -e
package/.husky/pre-commit DELETED
@@ -1,4 +0,0 @@
1
- #!/bin/sh
2
- . "$(dirname "$0")/_/husky.sh"
3
-
4
- lint-staged
package/.mocharc.js DELETED
@@ -1,9 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- recursive: true,
5
- spec: 'test/**/*.js',
6
- require: ['test/mocha-bootstrap.js'],
7
- reporter: 'mocha-multi-reporters',
8
- 'reporter-options': 'configFile=test/mocha-multi.json',
9
- };