@tempots/std 0.11.0 → 0.13.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/array.js CHANGED
@@ -1,223 +1,219 @@
1
- import { Maybe as v } from "./maybe.js";
2
- import { keys as w } from "./object.js";
3
- function _(n, e) {
4
- return Array.from({ length: n.length }, (t, r) => e(n[r], r));
1
+ import { objectKeys as v } from "./object.js";
2
+ function q(n, r) {
3
+ return Array.from({ length: n.length }, (t, e) => r(n[e], e));
5
4
  }
6
- function q(n, e) {
5
+ function B(n, r) {
7
6
  const t = [];
8
- for (let r = 0; r < n.length; r++) {
9
- const u = e(n[r], r);
10
- u != null && t.push(u);
11
- }
12
- return t;
13
- }
14
- function y(n, e) {
15
- const t = [];
16
- for (const r of n)
17
- t.push(...e(r));
7
+ for (const e of n)
8
+ t.push(...r(e));
18
9
  return t;
19
10
  }
20
- function B(n) {
21
- return n.length > 0 ? v.just(n[0]) : v.nothing;
11
+ function _(n) {
12
+ return n.length > 0 ? n[0] : void 0;
22
13
  }
23
- function I(n) {
14
+ function k(n) {
24
15
  return n.slice(1);
25
16
  }
26
- function A(n, e, t) {
27
- if (n.length !== e.length) return !1;
28
- for (let r = 0; r < n.length; r++)
29
- if (!t(n[r], e[r])) return !1;
17
+ function F(n, r, t) {
18
+ if (n.length !== r.length) return !1;
19
+ for (let e = 0; e < n.length; e++)
20
+ if (!t(n[e], r[e])) return !1;
30
21
  return !0;
31
22
  }
32
- function N(n) {
33
- return function(e, t) {
34
- return A(e, t, n);
35
- };
36
- }
37
- function O(n) {
23
+ function I(n) {
38
24
  return n.length === 0;
39
25
  }
40
- function j(n) {
26
+ function M(n) {
41
27
  return n.length > 0;
42
28
  }
43
- function E(n, e) {
29
+ function x(n, r) {
44
30
  const t = [];
45
- for (const r of n) e(r) && t.push(r);
31
+ for (const e of n) r(e) && t.push(e);
46
32
  return t;
47
33
  }
48
- function P(n, e) {
34
+ function b(n, r) {
49
35
  const t = [];
50
- for (let r = 0; r < n.length; r++) {
51
- const u = e(n[r], r);
36
+ for (let e = 0; e < n.length; e++) {
37
+ const u = r(n[e], e);
52
38
  u != null && t.push(u);
53
39
  }
54
40
  return t;
55
41
  }
56
- function S(n) {
57
- return E(n, (e) => e != null);
42
+ function j(n) {
43
+ return x(n, (r) => r != null);
58
44
  }
59
- function $(n) {
45
+ function D(n) {
60
46
  return [].concat(...n);
61
47
  }
62
- function C(n, e, t) {
63
- for (const r of n)
64
- t = e(t, r);
48
+ function P(n, r, t) {
49
+ for (const e of n)
50
+ t = r(t, e);
65
51
  return t;
66
52
  }
67
- function D(n, e) {
53
+ function S(n, r) {
68
54
  for (const t of n)
69
- if (!e(t))
55
+ if (!r(t))
70
56
  return !1;
71
57
  return !0;
72
58
  }
73
- function R(n, e) {
59
+ function N(n, r) {
74
60
  for (const t of n)
75
- if (e(t))
61
+ if (r(t))
76
62
  return !0;
77
63
  return !1;
78
64
  }
79
- function T(n, e) {
80
- for (const t of n) e(t);
65
+ function T(n, r) {
66
+ for (const t of n) r(t);
81
67
  }
82
- function L(...n) {
68
+ function $(...n) {
83
69
  return [].concat(...n);
84
70
  }
85
- function V(n, e = !0) {
86
- return function(t, r) {
87
- if (t.length < r.length)
88
- return -1 * (e ? 1 : -1);
89
- if (t.length > r.length)
90
- return 1 * (e ? 1 : -1);
91
- for (let u = 0; u < t.length; u++) {
92
- const s = n(t[u], r[u]);
93
- if (s !== 0) return s;
94
- }
95
- return 0;
96
- };
71
+ function H(n, r, t, e = !0) {
72
+ if (n.length < r.length)
73
+ return -1 * (e ? 1 : -1);
74
+ if (n.length > r.length)
75
+ return 1 * (e ? 1 : -1);
76
+ for (let u = 0; u < n.length; u++) {
77
+ const l = t(n[u], r[u]);
78
+ if (l !== 0) return l;
79
+ }
80
+ return 0;
97
81
  }
98
- function W(n, e) {
99
- return e.slice().sort(n);
82
+ function C(n, r) {
83
+ return n.slice().sort(r);
100
84
  }
101
- function x(n, e) {
102
- return Array.from({ length: n }, (t, r) => e(r));
85
+ function g(n, r) {
86
+ return Array.from({ length: n }, (t, e) => r(e));
103
87
  }
104
- function z(n, e = 0) {
105
- return x(n, (t) => e + t);
88
+ function L(n, r = 0) {
89
+ return g(n, (t) => r + t);
106
90
  }
107
- function G(n, e) {
108
- return x(n, () => e);
91
+ function R(n, r) {
92
+ return g(n, () => r);
109
93
  }
110
- function H(n) {
94
+ function V(n) {
111
95
  return Array.from(new Set(n));
112
96
  }
113
- function J(n, e) {
97
+ function W(n, r) {
114
98
  const t = {};
115
- return n.forEach((r) => {
116
- t[e(r)] = r;
117
- }), w(t).map((r) => t[r]);
99
+ return n.forEach((e) => {
100
+ t[r(e)] = e;
101
+ }), v(t).map((e) => t[e]);
118
102
  }
119
- function Q(n, e) {
120
- const t = n.indexOf(e);
103
+ function E(n, r) {
104
+ const t = n.indexOf(r);
121
105
  return t < 0 ? !1 : (n.splice(t, 1), !0);
122
106
  }
123
- function U(n, e) {
124
- const t = n.findIndex(e);
107
+ function z(n, r) {
108
+ let t = !1;
109
+ for (; E(n, r); )
110
+ t = !0;
111
+ return t;
112
+ }
113
+ function w(n, r) {
114
+ const t = n.findIndex(r);
125
115
  return t < 0 ? !1 : (n.splice(t, 1), !0);
126
116
  }
127
- function X(n) {
128
- const e = [];
117
+ function G(n, r) {
118
+ let t = !1;
119
+ for (; w(n, r); )
120
+ t = !0;
121
+ return t;
122
+ }
123
+ function J(n) {
124
+ const r = [];
129
125
  for (let t = n.next(); !(t.done ?? !1); t = n.next())
130
- e.push(t.value);
131
- return e;
126
+ r.push(t.value);
127
+ return r;
132
128
  }
133
- function Y(n, e, t) {
134
- const r = {
129
+ function Q(n, r, t) {
130
+ const e = {
135
131
  removals: [],
136
132
  swaps: [],
137
133
  inserts: []
138
- }, { removals: u, inserts: s, swaps: a } = r, i = /* @__PURE__ */ new Map();
139
- e.forEach((o, f) => i.set(t(o), f));
140
- const l = n.map((o, f) => [o, f]).filter(([o]) => !i.has(t(o))).map(([o, f]) => f);
141
- for (let o = l.length - 1; o >= 0; o--) {
142
- const f = l[o], c = u.length > 0 ? u[u.length - 1] : void 0;
143
- c != null && c.at === f + 1 ? (c.at--, c.qt++) : u.push({ at: f, qt: 1 });
134
+ }, { removals: u, inserts: l, swaps: c } = e, s = /* @__PURE__ */ new Map();
135
+ r.forEach((o, f) => s.set(t(o), f));
136
+ const a = n.map((o, f) => [o, f]).filter(([o]) => !s.has(t(o))).map(([o, f]) => f);
137
+ for (let o = a.length - 1; o >= 0; o--) {
138
+ const f = a[o], i = u.length > 0 ? u[u.length - 1] : void 0;
139
+ i != null && i.at === f + 1 ? (i.at--, i.qt++) : u.push({ at: f, qt: 1 });
144
140
  }
145
141
  const h = /* @__PURE__ */ new Map();
146
142
  n.forEach((o, f) => h.set(t(o), f));
147
- const g = e.map((o, f) => [o, f]).filter(([o]) => !h.has(t(o))).map(([o, f]) => f);
148
- for (const o of g) {
149
- const f = s.length > 0 ? s[s.length - 1] : void 0;
150
- f != null && f.at + f.values.length === o ? f.values.push(e[o]) : s.push({ at: o, values: [e[o]] });
143
+ const y = r.map((o, f) => [o, f]).filter(([o]) => !h.has(t(o))).map(([o, f]) => f);
144
+ for (const o of y) {
145
+ const f = l.length > 0 ? l[l.length - 1] : void 0;
146
+ f != null && f.at + f.values.length === o ? f.values.push(r[o]) : l.push({ at: o, values: [r[o]] });
151
147
  }
152
- const p = n.filter((o, f) => !l.includes(f)), m = /* @__PURE__ */ new Map();
148
+ const p = n.filter((o, f) => !a.includes(f)), m = /* @__PURE__ */ new Map();
153
149
  for (let o = 0; o < p.length; o++)
154
150
  m.set(t(p[o]), o);
155
- const d = e.filter((o, f) => !g.includes(f));
156
- for (let o = 0; o < d.length; o++) {
157
- const f = t(d[o]), c = m.get(f);
158
- if (c == null || o === c) continue;
159
- const k = t(p[o]);
160
- m.delete(k), a.push({ from: o, to: c });
151
+ const A = r.filter((o, f) => !y.includes(f));
152
+ for (let o = 0; o < A.length; o++) {
153
+ const f = t(A[o]), i = m.get(f);
154
+ if (i == null || o === i) continue;
155
+ const d = t(p[o]);
156
+ m.delete(d), c.push({ from: o, to: i });
161
157
  }
162
- return r;
158
+ return e;
163
159
  }
164
- function Z(n, e) {
165
- const t = [...e];
166
- for (const { at: r, qt: u } of n.removals)
167
- t.splice(r, u);
168
- for (const { from: r, to: u } of n.swaps) {
169
- const s = t[u];
170
- t[u] = t[r], t[r] = s;
160
+ function U(n, r) {
161
+ const t = [...r];
162
+ for (const { at: e, qt: u } of n.removals)
163
+ t.splice(e, u);
164
+ for (const { from: e, to: u } of n.swaps) {
165
+ const l = t[u];
166
+ t[u] = t[e], t[e] = l;
171
167
  }
172
- for (const r of n.inserts)
173
- t.splice(r.at, 0, ...r.values);
168
+ for (const e of n.inserts)
169
+ t.splice(e.at, 0, ...e.values);
174
170
  return t;
175
171
  }
176
- function F(n, e = " and ", t = ", ") {
177
- return n.length === 0 ? "" : n.length === 1 ? String(n[0]) : `${n.slice(0, -1).join(t)}${e}${String(n[n.length - 1])}`;
178
- }
179
- function K(n, e, t = !0) {
180
- const r = n.map((i, l) => [i, l]);
181
- r.sort((i, l) => e(i[0], l[0]));
182
- const u = new Array(r.length);
183
- let s = 0, a = r[0][0];
184
- for (let i = 0; i < r.length; i++) {
185
- const [l, h] = r[i];
186
- e(l, a) !== 0 && (s = i, a = l), u[h] = s, t && s++;
172
+ function X(n, r = " and ", t = ", ") {
173
+ return n.length === 0 ? "" : n.length === 1 ? String(n[0]) : `${n.slice(0, -1).join(t)}${r}${String(n[n.length - 1])}`;
174
+ }
175
+ function Y(n, r, t = !0) {
176
+ const e = n.map((s, a) => [s, a]);
177
+ e.sort((s, a) => r(s[0], a[0]));
178
+ const u = new Array(e.length);
179
+ let l = 0, c = e[0][0];
180
+ for (let s = 0; s < e.length; s++) {
181
+ const [a, h] = e[s];
182
+ r(a, c) !== 0 && (l = s, c = a), u[h] = l, t && l++;
187
183
  }
188
184
  return u;
189
185
  }
190
186
  export {
191
- D as all,
192
- R as any,
193
- Z as applyOperations,
194
- L as concat,
195
- Y as diffOperations,
196
- J as distinctByPredicate,
197
- H as distinctPrimitive,
198
- T as each,
199
- A as equals,
200
- G as fill,
201
- E as filter,
202
- P as filterMap,
203
- S as filterNulls,
204
- y as flatMap,
205
- $ as flatten,
206
- C as foldLeft,
207
- j as hasValues,
208
- B as head,
209
- O as isEmpty,
210
- F as joinWithConjunction,
211
- V as makeCompare,
212
- N as makeEquals,
213
- _ as map,
214
- q as mapNotNull,
215
- z as numbersRange,
216
- X as ofIterableIterator,
217
- x as range,
218
- K as rank,
219
- Q as remove,
220
- U as removeByPredicate,
221
- W as sort,
222
- I as tail
187
+ S as allElements,
188
+ N as anyElement,
189
+ U as applyArrayDiffOperations,
190
+ F as areArraysEqual,
191
+ Q as arrayDiffOperations,
192
+ M as arrayHasValues,
193
+ _ as arrayHead,
194
+ J as arrayOfIterableIterator,
195
+ k as arrayTail,
196
+ H as compareArrays,
197
+ $ as concatArrays,
198
+ R as createFilledArray,
199
+ x as filterArray,
200
+ b as filterMapArray,
201
+ j as filterNullsFromArray,
202
+ B as flatMapArray,
203
+ D as flattenArray,
204
+ P as foldLeftArray,
205
+ T as forEachElement,
206
+ g as generateArray,
207
+ L as generateSequenceArray,
208
+ I as isArrayEmpty,
209
+ X as joinArrayWithConjunction,
210
+ q as mapArray,
211
+ Y as rankArray,
212
+ z as removeAllFromArray,
213
+ G as removeAllFromArrayByPredicate,
214
+ E as removeOneFromArray,
215
+ w as removeOneFromArrayByPredicate,
216
+ C as sortArray,
217
+ W as uniqueByPredicate,
218
+ V as uniquePrimitives
223
219
  };
package/async-result.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u={notAsked:{type:"NotAsked"},loading(e=void 0){return{type:"Loading",previousValue:e}},success(e){return{type:"Success",value:e}},failure(e){return{type:"Failure",error:e}},isSuccess(e){return e.type==="Success"},isFailure(e){return e.type==="Failure"},isNotAsked(e){return e.type==="NotAsked"},isLoading(e){return e.type==="Loading"},getOrElse(e,s){return u.isSuccess(e)?e.value:s},getOrElseLazy(e,s){return u.isSuccess(e)?e.value:s()},getOrNull(e){return u.isSuccess(e)?e.value:null},getOrUndefined(e){return u.isSuccess(e)?e.value:void 0},cmatch:(e,s,t,i=t)=>r=>u.isSuccess(r)?e(r.value):u.isFailure(r)?s(r.error):u.isNotAsked(r)?i():t(r.previousValue),match:(e,s,t,i,r=i)=>u.isSuccess(e)?s(e.value):u.isFailure(e)?t(e.error):u.isNotAsked(e)?r():i(e.previousValue),whenSuccess:e=>s=>(u.isSuccess(s)&&e(s.value),s),whenFailure:e=>s=>(u.isFailure(s)&&e(s.error),s)};exports.AsyncResult=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s={notAsked:{type:"NotAsked"},loading(e=void 0){return{type:"Loading",previousValue:e}},success(e){return{type:"AsyncSuccess",value:e}},failure(e){return{type:"AsyncFailure",error:e}},isSuccess(e){return e.type==="AsyncSuccess"},isFailure(e){return e.type==="AsyncFailure"},isNotAsked(e){return e.type==="NotAsked"},isLoading(e){return e.type==="Loading"},getOrElse(e,u){return s.isSuccess(e)?e.value:u},getOrElseLazy(e,u){return s.isSuccess(e)?e.value:u()},getOrNull(e){return s.isSuccess(e)?e.value:null},getOrUndefined(e){return s.isSuccess(e)?e.value:void 0},match:(e,{success:u,failure:r,loading:t,notAsked:i=t})=>s.isSuccess(e)?u(e.value):s.isFailure(e)?r(e.error):s.isNotAsked(e)?i():t(e.previousValue),whenSuccess:(e,u)=>(s.isSuccess(e)&&u(e.value),e),whenFailure:(e,u)=>(s.isFailure(e)&&u(e.error),e)};exports.AsyncResult=s;
package/async-result.d.ts CHANGED
@@ -1,36 +1,175 @@
1
+ import { Maybe } from './domain';
2
+
3
+ /**
4
+ * Represents the state when a result has not been requested yet.
5
+ * @public
6
+ */
1
7
  export interface NotAsked {
2
8
  type: 'NotAsked';
3
9
  }
10
+ /**
11
+ * Represents a loading state in an asynchronous result.
12
+ * @public
13
+ */
4
14
  export interface Loading<V> {
5
15
  type: 'Loading';
6
16
  previousValue?: V;
7
17
  }
8
- export interface Success<V> {
9
- type: 'Success';
18
+ /**
19
+ * Represents a successful result.
20
+ * @typeParam V - The type of the value.
21
+ * @public
22
+ */
23
+ export interface AsyncSuccess<V> {
24
+ type: 'AsyncSuccess';
10
25
  value: V;
11
26
  }
12
- export interface Failure<E> {
13
- type: 'Failure';
27
+ /**
28
+ * Represents a failure result.
29
+ * @typeParam E - - The type of the error.
30
+ * @public
31
+ */
32
+ export interface AsyncFailure<E> {
33
+ type: 'AsyncFailure';
14
34
  error: E;
15
35
  }
16
- export type AsyncResult<V, E> = NotAsked | Loading<V> | Success<V> | Failure<E>;
36
+ /**
37
+ * Represents the result of an asynchronous operation that can be in one of the following states:
38
+ * - `NotAsked`: The operation has not been requested yet.
39
+ * - `Loading`: The operation is currently in progress.
40
+ * - `Success`: The operation has completed successfully and contains a value of type `V`.
41
+ * - `Failure`: The operation has completed with an error and contains an error of type `E`.
42
+ *
43
+ * @typeParam V - The type of the value on success.
44
+ * @typeParam E - The type of the error on failure.
45
+ * @public
46
+ */
47
+ export type AsyncResult<V, E> = NotAsked | Loading<V> | AsyncSuccess<V> | AsyncFailure<E>;
48
+ /**
49
+ * A set of utility functions for working with `AsyncResult`.
50
+ * @public
51
+ */
17
52
  export declare const AsyncResult: {
53
+ /**
54
+ * Creates a loading state.
55
+ * @param previousValue - The previous value.
56
+ * @returns A loading state.
57
+ * @public
58
+ */
18
59
  notAsked: {
19
60
  type: "NotAsked";
20
61
  };
21
- loading<V>(previousValue?: V | undefined): AsyncResult<V, never>;
62
+ /**
63
+ * Creates a loading state.
64
+ * @param previousValue - The previous value.
65
+ * @returns A loading state.
66
+ * @public
67
+ */
68
+ loading<V>(previousValue?: Maybe<V>): AsyncResult<V, never>;
69
+ /**
70
+ * Creates a successful state.
71
+ * @param value - The value.
72
+ * @returns A successful state.
73
+ * @public
74
+ */
22
75
  success<V>(value: V): AsyncResult<V, never>;
76
+ /**
77
+ * Creates a failure state.
78
+ * @param error - The error.
79
+ * @returns A failure state.
80
+ * @public
81
+ */
23
82
  failure<E>(error: E): AsyncResult<never, E>;
24
- isSuccess<V, E>(r: AsyncResult<V, E>): r is Success<V>;
25
- isFailure<V, E>(r: AsyncResult<V, E>): r is Failure<E>;
83
+ /**
84
+ * Checks if the result is a success.
85
+ * @param r - The result.
86
+ * @returns `true` if the result is a success; otherwise, `false`.
87
+ * @public
88
+ */
89
+ isSuccess<V, E>(r: AsyncResult<V, E>): r is AsyncSuccess<V>;
90
+ /**
91
+ * Checks if the result is a failure.
92
+ * @param r - The result.
93
+ * @returns `true` if the result is a failure; otherwise, `false`.
94
+ * @public
95
+ */
96
+ isFailure<V, E>(r: AsyncResult<V, E>): r is AsyncFailure<E>;
97
+ /**
98
+ * Checks if the result is a not-asked.
99
+ * @param r - The result.
100
+ * @returns `true` if the result is not-asked; otherwise, `false`.
101
+ * @public
102
+ */
26
103
  isNotAsked<V, E>(r: AsyncResult<V, E>): r is NotAsked;
104
+ /**
105
+ * Checks if the result is a loading.
106
+ * @param r - The result.
107
+ * @returns `true` if the result is loading; otherwise, `false`.
108
+ * @public
109
+ */
27
110
  isLoading<V, E>(r: AsyncResult<V, E>): r is Loading<V>;
111
+ /**
112
+ * Gets the value if the result is a success; otherwise, returns the alternative value.
113
+ * @param r - The result.
114
+ * @param alt - The alternative value.
115
+ * @returns The value if the result is a success; otherwise, the alternative value.
116
+ * @public
117
+ */
28
118
  getOrElse<V, E>(r: AsyncResult<V, E>, alt: V): V;
119
+ /**
120
+ * Gets the value if the result is a success; otherwise, returns the value from the alternative function.
121
+ * @param r - The result.
122
+ * @param altf - The alternative function.
123
+ * @returns The value if the result is a success; otherwise, the value from the alternative
124
+ * @public
125
+ * function.
126
+ */
29
127
  getOrElseLazy<V, E>(r: AsyncResult<V, E>, altf: () => V): V;
128
+ /**
129
+ * Gets the value if the result is a success; otherwise, returns `null`.
130
+ * @param r - The result.
131
+ * @returns The value if the result is a success; otherwise, `null`.
132
+ * @public
133
+ */
30
134
  getOrNull<V, E>(r: AsyncResult<V, E>): V | null;
31
- getOrUndefined<V, E>(r: AsyncResult<V, E>): V | undefined;
32
- cmatch: <V1, V2, E>(success: (value: V1) => V2, failure: (error: E) => V2, loading: (previousValue?: V1) => V2, idle?: () => V2) => (r: AsyncResult<V1, E>) => V2;
33
- match: <V1, V2, E>(r: AsyncResult<V1, E>, success: (value: V1) => V2, failure: (error: E) => V2, loading: (previousValue?: V1) => V2, idle?: () => V2) => V2;
34
- whenSuccess: <V, E>(apply: (v: V) => void) => (r: AsyncResult<V, E>) => AsyncResult<V, E>;
35
- whenFailure: <V, E>(apply: (e: E) => void) => (r: AsyncResult<V, E>) => AsyncResult<V, E>;
135
+ /**
136
+ * Gets the value if the result is a success; otherwise, returns `undefined`.
137
+ * @param r - The result.
138
+ * @returns The value if the result is a success; otherwise, `undefined`.
139
+ * @public
140
+ */
141
+ getOrUndefined<V, E>(r: AsyncResult<V, E>): Maybe<V>;
142
+ /**
143
+ * Based on the state of the result, it picks the appropriate function to call and returns the result.
144
+ * @param success - The function to call if the result is a success.
145
+ * @param failure - The function to call if the result is a failure.
146
+ * @param loading - The function to call if the result is loading.
147
+ * @param notAsked - The function to call if the result is not-asked.
148
+ * @returns The result of calling the appropriate function based on the state of the result.
149
+ * @public
150
+ */
151
+ match: <V1, V2, E>(r: AsyncResult<V1, E>, { success, failure, loading, notAsked, }: {
152
+ success: (value: V1) => V2;
153
+ failure: (error: E) => V2;
154
+ loading: (previousValue?: V1) => V2;
155
+ notAsked: () => V2;
156
+ }) => V2;
157
+ /**
158
+ * When the result is a success, it applies the function to the value.
159
+ *
160
+ * @param r - The result.
161
+ * @param apply - The function to apply.
162
+ * @returns The result that was passed in.
163
+ * @public
164
+ */
165
+ whenSuccess: <V, E>(r: AsyncResult<V, E>, apply: (v: V) => void) => AsyncResult<V, E>;
166
+ /**
167
+ * When the result is a failure, it applies the function to the error.
168
+ *
169
+ * @param r - The result.
170
+ * @param apply - The function to apply.
171
+ * @returns The result that was passed in.
172
+ * @public
173
+ */
174
+ whenFailure: <V, E>(r: AsyncResult<V, E>, apply: (e: E) => void) => AsyncResult<V, E>;
36
175
  };