@e280/stz 0.2.27 → 0.2.28
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/README.md +40 -0
- package/package.json +1 -1
- package/s/index.ts +2 -1
- package/s/ok/fns/err.ts +8 -0
- package/s/ok/fns/grab.ts +10 -0
- package/s/ok/fns/need.ts +20 -0
- package/s/ok/fns/ok.ts +8 -0
- package/s/ok/index.ts +10 -0
- package/s/ok/test.ts +47 -0
- package/s/ok/types/err.ts +4 -0
- package/s/ok/types/ok.ts +4 -0
- package/s/ok/types/result.ts +10 -0
- package/s/tests.test.ts +2 -1
- package/s/thrown.ts +7 -0
- package/x/index.d.ts +2 -0
- package/x/index.js +2 -0
- package/x/index.js.map +1 -1
- package/x/ok/fns/err.d.ts +3 -0
- package/x/ok/fns/err.js +5 -0
- package/x/ok/fns/err.js.map +1 -0
- package/x/ok/fns/grab.d.ts +3 -0
- package/x/ok/fns/grab.js +7 -0
- package/x/ok/fns/grab.js.map +1 -0
- package/x/ok/fns/need.d.ts +3 -0
- package/x/ok/fns/need.js +13 -0
- package/x/ok/fns/need.js.map +1 -0
- package/x/ok/fns/ok.d.ts +3 -0
- package/x/ok/fns/ok.js +5 -0
- package/x/ok/fns/ok.js.map +1 -0
- package/x/ok/index.d.ts +7 -0
- package/x/ok/index.js +8 -0
- package/x/ok/index.js.map +1 -0
- package/x/ok/test.d.ts +12 -0
- package/x/ok/test.js +39 -0
- package/x/ok/test.js.map +1 -0
- package/x/ok/types/err.d.ts +5 -0
- package/x/ok/types/err.js +2 -0
- package/x/ok/types/err.js.map +1 -0
- package/x/ok/types/ok.d.ts +5 -0
- package/x/ok/types/ok.js +2 -0
- package/x/ok/types/ok.js.map +1 -0
- package/x/ok/types/result.d.ts +4 -0
- package/x/ok/types/result.js +2 -0
- package/x/ok/types/result.js.map +1 -0
- package/x/tests.test.js +2 -0
- package/x/tests.test.js.map +1 -1
- package/x/thrown.d.ts +1 -0
- package/x/thrown.js +10 -0
- package/x/thrown.js.map +1 -0
package/README.md
CHANGED
|
@@ -315,6 +315,46 @@ const stop = cycle(async() => {
|
|
|
315
315
|
stop()
|
|
316
316
|
```
|
|
317
317
|
|
|
318
|
+
### 🍏 ok
|
|
319
|
+
> tiny result toolkit for saying "this worked" or "this did not work"
|
|
320
|
+
|
|
321
|
+
rust-inspired pattern for explicit error handling instead of the usual js yolo vibes
|
|
322
|
+
|
|
323
|
+
#### result shapes
|
|
324
|
+
- `Ok<Value>` — `{ok: true, value}`
|
|
325
|
+
- `Err<E>` — `{ok: false, error}`
|
|
326
|
+
- `Result<Value, E>` — either of the above
|
|
327
|
+
|
|
328
|
+
#### constructors
|
|
329
|
+
- `ok(value)` — make a successful result
|
|
330
|
+
```ts
|
|
331
|
+
const result = ok("fusion stable")
|
|
332
|
+
// {ok: true, value: "fusion stable"}
|
|
333
|
+
```
|
|
334
|
+
- `err(error)` — make a failed result
|
|
335
|
+
```ts
|
|
336
|
+
const result = err("containment lost")
|
|
337
|
+
// {ok: false, error: "containment lost"}
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
#### helpers
|
|
341
|
+
- `grab(result)` — get the value, or `undefined`
|
|
342
|
+
```ts
|
|
343
|
+
grab(ok(123))
|
|
344
|
+
// 123
|
|
345
|
+
|
|
346
|
+
grab(err("nope"))
|
|
347
|
+
// undefined
|
|
348
|
+
```
|
|
349
|
+
- `need(result)` — get the value, or throw
|
|
350
|
+
```ts
|
|
351
|
+
need(ok(123))
|
|
352
|
+
// 123
|
|
353
|
+
|
|
354
|
+
need(err("containment lost"))
|
|
355
|
+
// throws Error("containment lost")
|
|
356
|
+
```
|
|
357
|
+
|
|
318
358
|
|
|
319
359
|
|
|
320
360
|
<br/>
|
package/package.json
CHANGED
package/s/index.ts
CHANGED
|
@@ -23,8 +23,8 @@ export * from "./g/weak-map.js"
|
|
|
23
23
|
|
|
24
24
|
export * from "./queue/queue.js"
|
|
25
25
|
|
|
26
|
+
export * from "./ok/index.js"
|
|
26
27
|
export * from "./toq/index.js"
|
|
27
|
-
|
|
28
28
|
export * from "./maybe/index.js"
|
|
29
29
|
|
|
30
30
|
export * from "./all.js"
|
|
@@ -53,6 +53,7 @@ export * from "./provide.js"
|
|
|
53
53
|
export * from "./pubsub.js"
|
|
54
54
|
export * from "./scope.js"
|
|
55
55
|
export * from "./templating.js"
|
|
56
|
+
export * from "./thrown.js"
|
|
56
57
|
export * from "./time.js"
|
|
57
58
|
export * from "./trash.js"
|
|
58
59
|
export * from "./types.js"
|
package/s/ok/fns/err.ts
ADDED
package/s/ok/fns/grab.ts
ADDED
package/s/ok/fns/need.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
import type {Result} from "../types/result.js"
|
|
3
|
+
|
|
4
|
+
/** get value or throw error */
|
|
5
|
+
export function need<Value, E>(result: Result<Value, E>): Value {
|
|
6
|
+
if (result.ok)
|
|
7
|
+
return result.value
|
|
8
|
+
|
|
9
|
+
const {error} = result
|
|
10
|
+
|
|
11
|
+
if (error instanceof Error)
|
|
12
|
+
throw error
|
|
13
|
+
|
|
14
|
+
else if (typeof error === "string")
|
|
15
|
+
throw new Error(error)
|
|
16
|
+
|
|
17
|
+
else
|
|
18
|
+
throw new Error("unknown")
|
|
19
|
+
}
|
|
20
|
+
|
package/s/ok/fns/ok.ts
ADDED
package/s/ok/index.ts
ADDED
package/s/ok/test.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
|
|
2
|
+
import {expect, suite, test} from "@e280/science"
|
|
3
|
+
import {thrown} from "../thrown.js"
|
|
4
|
+
import {ok, err, grab, need} from "./index.js"
|
|
5
|
+
|
|
6
|
+
export default suite({
|
|
7
|
+
"ok": test(async() => {
|
|
8
|
+
expect(ok(123).ok).is(true)
|
|
9
|
+
expect(ok(123).value).is(123)
|
|
10
|
+
expect("error" in ok(123)).is(false)
|
|
11
|
+
}),
|
|
12
|
+
|
|
13
|
+
"err": test(async() => {
|
|
14
|
+
expect(err("nope").ok).is(false)
|
|
15
|
+
expect(err("nope").error).is("nope")
|
|
16
|
+
expect("value" in err("nope")).is(false)
|
|
17
|
+
}),
|
|
18
|
+
|
|
19
|
+
"grab": test(async() => {
|
|
20
|
+
expect(grab(ok(123))).is(123)
|
|
21
|
+
expect(grab(err("nope"))).is(undefined)
|
|
22
|
+
}),
|
|
23
|
+
|
|
24
|
+
"need": test(async() => {
|
|
25
|
+
expect(need(ok(123))).is(123)
|
|
26
|
+
expect(() => need(err("nope"))).throws()
|
|
27
|
+
}),
|
|
28
|
+
|
|
29
|
+
"need error handling": {
|
|
30
|
+
"rethrows errors": test(async() => {
|
|
31
|
+
const error = new TypeError()
|
|
32
|
+
expect(() => need(err(error))).throws(TypeError)
|
|
33
|
+
expect(thrown(() => need(err(error)))).is(error)
|
|
34
|
+
}),
|
|
35
|
+
|
|
36
|
+
"upgrades strings to errors": test(async() => {
|
|
37
|
+
expect(() => need(err("nope"))).throws(Error)
|
|
38
|
+
expect(thrown(() => need(err("nope"))).message).is("nope")
|
|
39
|
+
}),
|
|
40
|
+
|
|
41
|
+
"everything else is unknown": test(async() => {
|
|
42
|
+
expect(() => need(err({code: 234}))).throws(Error)
|
|
43
|
+
expect(thrown(() => need(err({code: 234}))).message).is("unknown")
|
|
44
|
+
}),
|
|
45
|
+
},
|
|
46
|
+
})
|
|
47
|
+
|
package/s/ok/types/ok.ts
ADDED
package/s/tests.test.ts
CHANGED
|
@@ -8,6 +8,7 @@ import deep from "./deep/index.test.js"
|
|
|
8
8
|
import queue from "./queue/queue.test.js"
|
|
9
9
|
import toq from "./toq/toq.test.js"
|
|
10
10
|
import maybe from "./maybe/test.js"
|
|
11
|
+
import ok from "./ok/test.js"
|
|
11
12
|
|
|
12
13
|
await Science.run({
|
|
13
14
|
data,
|
|
@@ -17,5 +18,5 @@ await Science.run({
|
|
|
17
18
|
queue,
|
|
18
19
|
toq,
|
|
19
20
|
maybe,
|
|
21
|
+
ok,
|
|
20
22
|
})
|
|
21
|
-
|
package/s/thrown.ts
ADDED
package/x/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from "./g/pool.js";
|
|
|
17
17
|
export * from "./g/set.js";
|
|
18
18
|
export * from "./g/weak-map.js";
|
|
19
19
|
export * from "./queue/queue.js";
|
|
20
|
+
export * from "./ok/index.js";
|
|
20
21
|
export * from "./toq/index.js";
|
|
21
22
|
export * from "./maybe/index.js";
|
|
22
23
|
export * from "./all.js";
|
|
@@ -45,6 +46,7 @@ export * from "./provide.js";
|
|
|
45
46
|
export * from "./pubsub.js";
|
|
46
47
|
export * from "./scope.js";
|
|
47
48
|
export * from "./templating.js";
|
|
49
|
+
export * from "./thrown.js";
|
|
48
50
|
export * from "./time.js";
|
|
49
51
|
export * from "./trash.js";
|
|
50
52
|
export * from "./types.js";
|
package/x/index.js
CHANGED
|
@@ -17,6 +17,7 @@ export * from "./g/pool.js";
|
|
|
17
17
|
export * from "./g/set.js";
|
|
18
18
|
export * from "./g/weak-map.js";
|
|
19
19
|
export * from "./queue/queue.js";
|
|
20
|
+
export * from "./ok/index.js";
|
|
20
21
|
export * from "./toq/index.js";
|
|
21
22
|
export * from "./maybe/index.js";
|
|
22
23
|
export * from "./all.js";
|
|
@@ -45,6 +46,7 @@ export * from "./provide.js";
|
|
|
45
46
|
export * from "./pubsub.js";
|
|
46
47
|
export * from "./scope.js";
|
|
47
48
|
export * from "./templating.js";
|
|
49
|
+
export * from "./thrown.js";
|
|
48
50
|
export * from "./time.js";
|
|
49
51
|
export * from "./trash.js";
|
|
50
52
|
export * from "./types.js";
|
package/x/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../s/index.ts"],"names":[],"mappings":"AACA,cAAc,6BAA6B,CAAA;AAC3C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,yBAAyB,CAAA;AACvC,cAAc,yBAAyB,CAAA;AACvC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,sBA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AAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA"}
|
package/x/ok/fns/err.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"err.js","sourceRoot":"","sources":["../../../s/ok/fns/err.ts"],"names":[],"mappings":"AAGA,cAAc;AACd,MAAM,UAAU,GAAG,CAAa,KAAQ;IACvC,OAAO,EAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAC,CAAA;AAC1B,CAAC"}
|
package/x/ok/fns/grab.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grab.js","sourceRoot":"","sources":["../../../s/ok/fns/grab.ts"],"names":[],"mappings":"AAGA,6BAA6B;AAC7B,MAAM,UAAU,IAAI,CAAQ,MAA8B;IACzD,OAAO,MAAM,CAAC,EAAE;QACf,CAAC,CAAC,MAAM,CAAC,KAAK;QACd,CAAC,CAAC,SAAS,CAAA;AACb,CAAC"}
|
package/x/ok/fns/need.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** get value or throw error */
|
|
2
|
+
export function need(result) {
|
|
3
|
+
if (result.ok)
|
|
4
|
+
return result.value;
|
|
5
|
+
const { error } = result;
|
|
6
|
+
if (error instanceof Error)
|
|
7
|
+
throw error;
|
|
8
|
+
else if (typeof error === "string")
|
|
9
|
+
throw new Error(error);
|
|
10
|
+
else
|
|
11
|
+
throw new Error("unknown");
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=need.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"need.js","sourceRoot":"","sources":["../../../s/ok/fns/need.ts"],"names":[],"mappings":"AAGA,+BAA+B;AAC/B,MAAM,UAAU,IAAI,CAAW,MAAwB;IACtD,IAAI,MAAM,CAAC,EAAE;QACZ,OAAO,MAAM,CAAC,KAAK,CAAA;IAEpB,MAAM,EAAC,KAAK,EAAC,GAAG,MAAM,CAAA;IAEtB,IAAI,KAAK,YAAY,KAAK;QACzB,MAAM,KAAK,CAAA;SAEP,IAAI,OAAO,KAAK,KAAK,QAAQ;QACjC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAA;;QAGtB,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,CAAA;AAC5B,CAAC"}
|
package/x/ok/fns/ok.d.ts
ADDED
package/x/ok/fns/ok.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ok.js","sourceRoot":"","sources":["../../../s/ok/fns/ok.ts"],"names":[],"mappings":"AAGA,cAAc;AACd,MAAM,UAAU,EAAE,CAAQ,KAAY;IACrC,OAAO,EAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAC,CAAA;AACzB,CAAC"}
|
package/x/ok/index.d.ts
ADDED
package/x/ok/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./fns/ok.js";
|
|
2
|
+
export * from "./fns/err.js";
|
|
3
|
+
export * from "./fns/grab.js";
|
|
4
|
+
export * from "./fns/need.js";
|
|
5
|
+
export * from "./types/ok.js";
|
|
6
|
+
export * from "./types/err.js";
|
|
7
|
+
export * from "./types/result.js";
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../s/ok/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAE7B,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA"}
|
package/x/ok/test.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
ok: import("@e280/science").Test;
|
|
3
|
+
err: import("@e280/science").Test;
|
|
4
|
+
grab: import("@e280/science").Test;
|
|
5
|
+
need: import("@e280/science").Test;
|
|
6
|
+
"need error handling": {
|
|
7
|
+
"rethrows errors": import("@e280/science").Test;
|
|
8
|
+
"upgrades strings to errors": import("@e280/science").Test;
|
|
9
|
+
"everything else is unknown": import("@e280/science").Test;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export default _default;
|
package/x/ok/test.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { expect, suite, test } from "@e280/science";
|
|
2
|
+
import { thrown } from "../thrown.js";
|
|
3
|
+
import { ok, err, grab, need } from "./index.js";
|
|
4
|
+
export default suite({
|
|
5
|
+
"ok": test(async () => {
|
|
6
|
+
expect(ok(123).ok).is(true);
|
|
7
|
+
expect(ok(123).value).is(123);
|
|
8
|
+
expect("error" in ok(123)).is(false);
|
|
9
|
+
}),
|
|
10
|
+
"err": test(async () => {
|
|
11
|
+
expect(err("nope").ok).is(false);
|
|
12
|
+
expect(err("nope").error).is("nope");
|
|
13
|
+
expect("value" in err("nope")).is(false);
|
|
14
|
+
}),
|
|
15
|
+
"grab": test(async () => {
|
|
16
|
+
expect(grab(ok(123))).is(123);
|
|
17
|
+
expect(grab(err("nope"))).is(undefined);
|
|
18
|
+
}),
|
|
19
|
+
"need": test(async () => {
|
|
20
|
+
expect(need(ok(123))).is(123);
|
|
21
|
+
expect(() => need(err("nope"))).throws();
|
|
22
|
+
}),
|
|
23
|
+
"need error handling": {
|
|
24
|
+
"rethrows errors": test(async () => {
|
|
25
|
+
const error = new TypeError();
|
|
26
|
+
expect(() => need(err(error))).throws(TypeError);
|
|
27
|
+
expect(thrown(() => need(err(error)))).is(error);
|
|
28
|
+
}),
|
|
29
|
+
"upgrades strings to errors": test(async () => {
|
|
30
|
+
expect(() => need(err("nope"))).throws(Error);
|
|
31
|
+
expect(thrown(() => need(err("nope"))).message).is("nope");
|
|
32
|
+
}),
|
|
33
|
+
"everything else is unknown": test(async () => {
|
|
34
|
+
expect(() => need(err({ code: 234 }))).throws(Error);
|
|
35
|
+
expect(thrown(() => need(err({ code: 234 }))).message).is("unknown");
|
|
36
|
+
}),
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=test.js.map
|
package/x/ok/test.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../s/ok/test.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAC,MAAM,eAAe,CAAA;AACjD,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAA;AACnC,OAAO,EAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAC,MAAM,YAAY,CAAA;AAE9C,eAAe,KAAK,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC,KAAK,IAAG,EAAE;QACpB,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;QAC3B,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAA;QAC7B,MAAM,CAAC,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AC,CAAA;YAChD,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;QACjD,CAAC,CAAC;QAEF,4BAA4B,EAAE,IAAI,CAAC,KAAK,IAAG,EAAE;YAC5C,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YAC7C,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAA;QAC3D,CAAC,CAAC;QAEF,4BAA4B,EAAE,IAAI,CAAC,KAAK,IAAG,EAAE;YAC5C,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAC,IAAI,EAAE,GAAG,EAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YAClD,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAC,IAAI,EAAE,GAAG,EAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,CAAA;QACnE,CAAC,CAAC;KACF;CACD,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"err.js","sourceRoot":"","sources":["../../../s/ok/types/err.ts"],"names":[],"mappings":""}
|
package/x/ok/types/ok.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ok.js","sourceRoot":"","sources":["../../../s/ok/types/ok.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result.js","sourceRoot":"","sources":["../../../s/ok/types/result.ts"],"names":[],"mappings":""}
|
package/x/tests.test.js
CHANGED
|
@@ -6,6 +6,7 @@ import deep from "./deep/index.test.js";
|
|
|
6
6
|
import queue from "./queue/queue.test.js";
|
|
7
7
|
import toq from "./toq/toq.test.js";
|
|
8
8
|
import maybe from "./maybe/test.js";
|
|
9
|
+
import ok from "./ok/test.js";
|
|
9
10
|
await Science.run({
|
|
10
11
|
data,
|
|
11
12
|
debounce,
|
|
@@ -14,5 +15,6 @@ await Science.run({
|
|
|
14
15
|
queue,
|
|
15
16
|
toq,
|
|
16
17
|
maybe,
|
|
18
|
+
ok,
|
|
17
19
|
});
|
|
18
20
|
//# sourceMappingURL=tests.test.js.map
|
package/x/tests.test.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tests.test.js","sourceRoot":"","sources":["../s/tests.test.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAA;AAErC,OAAO,IAAI,MAAM,qBAAqB,CAAA;AACtC,OAAO,QAAQ,MAAM,6BAA6B,CAAA;AAClD,OAAO,WAAW,MAAM,gCAAgC,CAAA;AACxD,OAAO,IAAI,MAAM,sBAAsB,CAAA;AACvC,OAAO,KAAK,MAAM,uBAAuB,CAAA;AACzC,OAAO,GAAG,MAAM,mBAAmB,CAAA;AACnC,OAAO,KAAK,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"tests.test.js","sourceRoot":"","sources":["../s/tests.test.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAA;AAErC,OAAO,IAAI,MAAM,qBAAqB,CAAA;AACtC,OAAO,QAAQ,MAAM,6BAA6B,CAAA;AAClD,OAAO,WAAW,MAAM,gCAAgC,CAAA;AACxD,OAAO,IAAI,MAAM,sBAAsB,CAAA;AACvC,OAAO,KAAK,MAAM,uBAAuB,CAAA;AACzC,OAAO,GAAG,MAAM,mBAAmB,CAAA;AACnC,OAAO,KAAK,MAAM,iBAAiB,CAAA;AACnC,OAAO,EAAE,MAAM,cAAc,CAAA;AAE7B,MAAM,OAAO,CAAC,GAAG,CAAC;IACjB,IAAI;IACJ,QAAQ;IACR,WAAW;IACX,IAAI;IACJ,KAAK;IACL,GAAG;IACH,KAAK;IACL,EAAE;CACF,CAAC,CAAA"}
|
package/x/thrown.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function thrown(fn: () => unknown): any;
|
package/x/thrown.js
ADDED
package/x/thrown.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thrown.js","sourceRoot":"","sources":["../s/thrown.ts"],"names":[],"mappings":"AACA,MAAM,UAAU,MAAM,CAAC,EAAiB;IACvC,IAAI,CAAC;QAAC,EAAE,EAAE,CAAA;IAAC,CAAC;IACZ,OAAO,KAAK,EAAE,CAAC;QAAC,OAAO,KAAK,CAAA;IAAC,CAAC;IAC9B,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAA;AAChC,CAAC"}
|