@unthrown/neverthrow 0.3.0 → 1.0.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/README.md CHANGED
@@ -16,11 +16,11 @@ every neverthrow result is an `Ok` or `Err` — never a `Defect`. Going **out**,
16
16
  `onDefect` — no defect is ever silently folded into your domain error type.
17
17
 
18
18
  ```ts
19
- import { ok } from "unthrown";
19
+ import { Ok } from "unthrown";
20
20
  import { toNeverthrow, fromNeverthrow } from "@unthrown/neverthrow";
21
21
  import { ok as ntOk } from "neverthrow";
22
22
 
23
- toNeverthrow(ok(1), (cause) => ({ _tag: "Bug", cause })); // neverthrow Ok(1)
23
+ toNeverthrow(Ok(1), (cause) => ({ _tag: "Bug", cause })); // neverthrow Ok(1)
24
24
  fromNeverthrow(ntOk(1)); // Result<number, never>
25
25
  ```
26
26
 
package/dist/index.cjs CHANGED
@@ -3,17 +3,17 @@ let neverthrow = require("neverthrow");
3
3
  let unthrown = require("unthrown");
4
4
  //#region src/index.ts
5
5
  /**
6
- * Convert a `Result` into a neverthrow `Result`, triaging any defect.
6
+ * Convert a `Result` into a neverthrow `Result`, triaging any Defect.
7
7
  *
8
8
  * @remarks
9
- * neverthrow has no defect channel, so `onDefect` **must** fold a `Defect`'s
10
- * cause into a modeled error `E` (an `Err`). `Ok → ok`, `Err → err`,
11
- * `Defect → err(onDefect(cause))`.
9
+ * neverthrow has no Defect channel, so `onDefect` **must** fold a `Defect`'s
10
+ * cause into a modeled error `E` (an `Err`). `Ok → Ok`, `Err → Err`,
11
+ * `Defect → Err(onDefect(cause))`.
12
12
  *
13
13
  * @typeParam T - the success value type.
14
14
  * @typeParam E - the modeled error type.
15
15
  * @param result - the result to convert.
16
- * @param onDefect - folds a defect's unknown cause into a modeled `E`.
16
+ * @param onDefect - folds a Defect's unknown cause into a modeled `E`.
17
17
  */
18
18
  function toNeverthrow(result, onDefect) {
19
19
  return result.match({
@@ -26,7 +26,7 @@ function toNeverthrow(result, onDefect) {
26
26
  * Convert a neverthrow `Result` into a `Result`.
27
27
  *
28
28
  * @remarks
29
- * `ok → Ok`, `err → Err`. neverthrow carries no defect, so the result is never a
29
+ * `Ok → Ok`, `Err → Err`. neverthrow carries no Defect, so the result is never a
30
30
  * `Defect`.
31
31
  *
32
32
  * @typeParam T - the success value type.
@@ -34,11 +34,11 @@ function toNeverthrow(result, onDefect) {
34
34
  * @param result - the neverthrow result to convert.
35
35
  */
36
36
  function fromNeverthrow(result) {
37
- return result.isOk() ? (0, unthrown.ok)(result.value) : (0, unthrown.err)(result.error);
37
+ return result.isOk() ? (0, unthrown.Ok)(result.value) : (0, unthrown.Err)(result.error);
38
38
  }
39
39
  /**
40
40
  * Convert an `AsyncResult` into a neverthrow `ResultAsync`, triaging any
41
- * defect.
41
+ * Defect.
42
42
  *
43
43
  * @remarks
44
44
  * The async counterpart of {@link toNeverthrow}: `onDefect` is required for the
@@ -48,7 +48,7 @@ function fromNeverthrow(result) {
48
48
  * @typeParam T - the success value type.
49
49
  * @typeParam E - the modeled error type.
50
50
  * @param asyncResult - the async result to convert.
51
- * @param onDefect - folds a defect's unknown cause into a modeled `E`.
51
+ * @param onDefect - folds a Defect's unknown cause into a modeled `E`.
52
52
  */
53
53
  function toNeverthrowAsync(asyncResult, onDefect) {
54
54
  return neverthrow.ResultAsync.fromSafePromise(settle(asyncResult)).andThen((result) => toNeverthrow(result, onDefect));
package/dist/index.d.cts CHANGED
@@ -3,24 +3,24 @@ import { AsyncResult, Result as Result$1 } from "unthrown";
3
3
 
4
4
  //#region src/index.d.ts
5
5
  /**
6
- * Convert a `Result` into a neverthrow `Result`, triaging any defect.
6
+ * Convert a `Result` into a neverthrow `Result`, triaging any Defect.
7
7
  *
8
8
  * @remarks
9
- * neverthrow has no defect channel, so `onDefect` **must** fold a `Defect`'s
10
- * cause into a modeled error `E` (an `Err`). `Ok → ok`, `Err → err`,
11
- * `Defect → err(onDefect(cause))`.
9
+ * neverthrow has no Defect channel, so `onDefect` **must** fold a `Defect`'s
10
+ * cause into a modeled error `E` (an `Err`). `Ok → Ok`, `Err → Err`,
11
+ * `Defect → Err(onDefect(cause))`.
12
12
  *
13
13
  * @typeParam T - the success value type.
14
14
  * @typeParam E - the modeled error type.
15
15
  * @param result - the result to convert.
16
- * @param onDefect - folds a defect's unknown cause into a modeled `E`.
16
+ * @param onDefect - folds a Defect's unknown cause into a modeled `E`.
17
17
  */
18
18
  declare function toNeverthrow<T, E>(result: Result$1<T, E>, onDefect: (cause: unknown) => E): Result<T, E>;
19
19
  /**
20
20
  * Convert a neverthrow `Result` into a `Result`.
21
21
  *
22
22
  * @remarks
23
- * `ok → Ok`, `err → Err`. neverthrow carries no defect, so the result is never a
23
+ * `Ok → Ok`, `Err → Err`. neverthrow carries no Defect, so the result is never a
24
24
  * `Defect`.
25
25
  *
26
26
  * @typeParam T - the success value type.
@@ -30,7 +30,7 @@ declare function toNeverthrow<T, E>(result: Result$1<T, E>, onDefect: (cause: un
30
30
  declare function fromNeverthrow<T, E>(result: Result<T, E>): Result$1<T, E>;
31
31
  /**
32
32
  * Convert an `AsyncResult` into a neverthrow `ResultAsync`, triaging any
33
- * defect.
33
+ * Defect.
34
34
  *
35
35
  * @remarks
36
36
  * The async counterpart of {@link toNeverthrow}: `onDefect` is required for the
@@ -40,7 +40,7 @@ declare function fromNeverthrow<T, E>(result: Result<T, E>): Result$1<T, E>;
40
40
  * @typeParam T - the success value type.
41
41
  * @typeParam E - the modeled error type.
42
42
  * @param asyncResult - the async result to convert.
43
- * @param onDefect - folds a defect's unknown cause into a modeled `E`.
43
+ * @param onDefect - folds a Defect's unknown cause into a modeled `E`.
44
44
  */
45
45
  declare function toNeverthrowAsync<T, E>(asyncResult: AsyncResult<T, E>, onDefect: (cause: unknown) => E): ResultAsync<T, E>;
46
46
  /**
package/dist/index.d.mts CHANGED
@@ -3,24 +3,24 @@ import { AsyncResult, Result as Result$1 } from "unthrown";
3
3
 
4
4
  //#region src/index.d.ts
5
5
  /**
6
- * Convert a `Result` into a neverthrow `Result`, triaging any defect.
6
+ * Convert a `Result` into a neverthrow `Result`, triaging any Defect.
7
7
  *
8
8
  * @remarks
9
- * neverthrow has no defect channel, so `onDefect` **must** fold a `Defect`'s
10
- * cause into a modeled error `E` (an `Err`). `Ok → ok`, `Err → err`,
11
- * `Defect → err(onDefect(cause))`.
9
+ * neverthrow has no Defect channel, so `onDefect` **must** fold a `Defect`'s
10
+ * cause into a modeled error `E` (an `Err`). `Ok → Ok`, `Err → Err`,
11
+ * `Defect → Err(onDefect(cause))`.
12
12
  *
13
13
  * @typeParam T - the success value type.
14
14
  * @typeParam E - the modeled error type.
15
15
  * @param result - the result to convert.
16
- * @param onDefect - folds a defect's unknown cause into a modeled `E`.
16
+ * @param onDefect - folds a Defect's unknown cause into a modeled `E`.
17
17
  */
18
18
  declare function toNeverthrow<T, E>(result: Result$1<T, E>, onDefect: (cause: unknown) => E): Result<T, E>;
19
19
  /**
20
20
  * Convert a neverthrow `Result` into a `Result`.
21
21
  *
22
22
  * @remarks
23
- * `ok → Ok`, `err → Err`. neverthrow carries no defect, so the result is never a
23
+ * `Ok → Ok`, `Err → Err`. neverthrow carries no Defect, so the result is never a
24
24
  * `Defect`.
25
25
  *
26
26
  * @typeParam T - the success value type.
@@ -30,7 +30,7 @@ declare function toNeverthrow<T, E>(result: Result$1<T, E>, onDefect: (cause: un
30
30
  declare function fromNeverthrow<T, E>(result: Result<T, E>): Result$1<T, E>;
31
31
  /**
32
32
  * Convert an `AsyncResult` into a neverthrow `ResultAsync`, triaging any
33
- * defect.
33
+ * Defect.
34
34
  *
35
35
  * @remarks
36
36
  * The async counterpart of {@link toNeverthrow}: `onDefect` is required for the
@@ -40,7 +40,7 @@ declare function fromNeverthrow<T, E>(result: Result<T, E>): Result$1<T, E>;
40
40
  * @typeParam T - the success value type.
41
41
  * @typeParam E - the modeled error type.
42
42
  * @param asyncResult - the async result to convert.
43
- * @param onDefect - folds a defect's unknown cause into a modeled `E`.
43
+ * @param onDefect - folds a Defect's unknown cause into a modeled `E`.
44
44
  */
45
45
  declare function toNeverthrowAsync<T, E>(asyncResult: AsyncResult<T, E>, onDefect: (cause: unknown) => E): ResultAsync<T, E>;
46
46
  /**
package/dist/index.mjs CHANGED
@@ -1,18 +1,18 @@
1
1
  import { ResultAsync, err, ok } from "neverthrow";
2
- import { err as err$1, fromSafePromise, ok as ok$1 } from "unthrown";
2
+ import { Err, Ok, fromSafePromise } from "unthrown";
3
3
  //#region src/index.ts
4
4
  /**
5
- * Convert a `Result` into a neverthrow `Result`, triaging any defect.
5
+ * Convert a `Result` into a neverthrow `Result`, triaging any Defect.
6
6
  *
7
7
  * @remarks
8
- * neverthrow has no defect channel, so `onDefect` **must** fold a `Defect`'s
9
- * cause into a modeled error `E` (an `Err`). `Ok → ok`, `Err → err`,
10
- * `Defect → err(onDefect(cause))`.
8
+ * neverthrow has no Defect channel, so `onDefect` **must** fold a `Defect`'s
9
+ * cause into a modeled error `E` (an `Err`). `Ok → Ok`, `Err → Err`,
10
+ * `Defect → Err(onDefect(cause))`.
11
11
  *
12
12
  * @typeParam T - the success value type.
13
13
  * @typeParam E - the modeled error type.
14
14
  * @param result - the result to convert.
15
- * @param onDefect - folds a defect's unknown cause into a modeled `E`.
15
+ * @param onDefect - folds a Defect's unknown cause into a modeled `E`.
16
16
  */
17
17
  function toNeverthrow(result, onDefect) {
18
18
  return result.match({
@@ -25,7 +25,7 @@ function toNeverthrow(result, onDefect) {
25
25
  * Convert a neverthrow `Result` into a `Result`.
26
26
  *
27
27
  * @remarks
28
- * `ok → Ok`, `err → Err`. neverthrow carries no defect, so the result is never a
28
+ * `Ok → Ok`, `Err → Err`. neverthrow carries no Defect, so the result is never a
29
29
  * `Defect`.
30
30
  *
31
31
  * @typeParam T - the success value type.
@@ -33,11 +33,11 @@ function toNeverthrow(result, onDefect) {
33
33
  * @param result - the neverthrow result to convert.
34
34
  */
35
35
  function fromNeverthrow(result) {
36
- return result.isOk() ? ok$1(result.value) : err$1(result.error);
36
+ return result.isOk() ? Ok(result.value) : Err(result.error);
37
37
  }
38
38
  /**
39
39
  * Convert an `AsyncResult` into a neverthrow `ResultAsync`, triaging any
40
- * defect.
40
+ * Defect.
41
41
  *
42
42
  * @remarks
43
43
  * The async counterpart of {@link toNeverthrow}: `onDefect` is required for the
@@ -47,7 +47,7 @@ function fromNeverthrow(result) {
47
47
  * @typeParam T - the success value type.
48
48
  * @typeParam E - the modeled error type.
49
49
  * @param asyncResult - the async result to convert.
50
- * @param onDefect - folds a defect's unknown cause into a modeled `E`.
50
+ * @param onDefect - folds a Defect's unknown cause into a modeled `E`.
51
51
  */
52
52
  function toNeverthrowAsync(asyncResult, onDefect) {
53
53
  return ResultAsync.fromSafePromise(settle(asyncResult)).andThen((result) => toNeverthrow(result, onDefect));
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["neverthrowOk","neverthrowErr","ok","err","NeverthrowResultAsync"],"sources":["../src/index.ts"],"sourcesContent":["// @unthrown/neverthrow — interop between unthrown's `Result`/`AsyncResult` and\n// neverthrow's `Result`/`ResultAsync`.\n//\n// neverthrow has two channels (`Ok`/`Err`), so it cannot represent unthrown's\n// third one. Coming *in*, every neverthrow result is an `Ok` or `Err` — never a\n// `Defect`. Going *out*, a `Defect` has nowhere to live, so `toNeverthrow`\n// forces you to triage it with `onDefect` (Thesis #3): no defect is ever\n// silently folded into your domain error type.\n//\n// import { ok } from \"unthrown\";\n// import { toNeverthrow, fromNeverthrow } from \"@unthrown/neverthrow\";\n//\n// toNeverthrow(ok(1), (cause) => ({ _tag: \"Bug\", cause }));\n// fromNeverthrow(neverthrowOk(1)); // Result<number, never>\n\nimport {\n err as neverthrowErr,\n ok as neverthrowOk,\n ResultAsync as NeverthrowResultAsync,\n} from \"neverthrow\";\nimport type { Result as NeverthrowResult } from \"neverthrow\";\nimport { err, fromSafePromise, ok } from \"unthrown\";\nimport type { AsyncResult, Result } from \"unthrown\";\n\n/**\n * Convert a `Result` into a neverthrow `Result`, triaging any defect.\n *\n * @remarks\n * neverthrow has no defect channel, so `onDefect` **must** fold a `Defect`'s\n * cause into a modeled error `E` (an `Err`). `Ok → ok`, `Err → err`,\n * `Defect → err(onDefect(cause))`.\n *\n * @typeParam T - the success value type.\n * @typeParam E - the modeled error type.\n * @param result - the result to convert.\n * @param onDefect - folds a defect's unknown cause into a modeled `E`.\n */\nexport function toNeverthrow<T, E>(\n result: Result<T, E>,\n onDefect: (cause: unknown) => E,\n): NeverthrowResult<T, E> {\n return result.match<NeverthrowResult<T, E>>({\n ok: (value) => neverthrowOk(value),\n err: (error) => neverthrowErr(error),\n defect: (cause) => neverthrowErr(onDefect(cause)),\n });\n}\n\n/**\n * Convert a neverthrow `Result` into a `Result`.\n *\n * @remarks\n * `ok → Ok`, `err → Err`. neverthrow carries no defect, so the result is never a\n * `Defect`.\n *\n * @typeParam T - the success value type.\n * @typeParam E - the modeled error type.\n * @param result - the neverthrow result to convert.\n */\nexport function fromNeverthrow<T, E>(result: NeverthrowResult<T, E>): Result<T, E> {\n return result.isOk() ? ok(result.value) : err(result.error);\n}\n\n/**\n * Convert an `AsyncResult` into a neverthrow `ResultAsync`, triaging any\n * defect.\n *\n * @remarks\n * The async counterpart of {@link toNeverthrow}: `onDefect` is required for the\n * same reason. The `AsyncResult` is awaited (it never rejects) and each settled\n * `Result` is converted.\n *\n * @typeParam T - the success value type.\n * @typeParam E - the modeled error type.\n * @param asyncResult - the async result to convert.\n * @param onDefect - folds a defect's unknown cause into a modeled `E`.\n */\nexport function toNeverthrowAsync<T, E>(\n asyncResult: AsyncResult<T, E>,\n onDefect: (cause: unknown) => E,\n): NeverthrowResultAsync<T, E> {\n return NeverthrowResultAsync.fromSafePromise(settle(asyncResult)).andThen((result) =>\n toNeverthrow(result, onDefect),\n );\n}\n\n/**\n * Convert a neverthrow `ResultAsync` into an `AsyncResult`.\n *\n * @remarks\n * The async counterpart of {@link fromNeverthrow}. A modeled `Err` stays an\n * `Err`; an *unexpected* rejection inside the neverthrow chain becomes a\n * `Defect`. The returned `AsyncResult` never throws when awaited.\n *\n * @typeParam T - the success value type.\n * @typeParam E - the modeled error type.\n * @param resultAsync - the neverthrow async result to convert.\n */\nexport function fromNeverthrowAsync<T, E>(\n resultAsync: NeverthrowResultAsync<T, E>,\n): AsyncResult<T, E> {\n return fromSafePromise(Promise.resolve(resultAsync)).flatMap((result) => fromNeverthrow(result));\n}\n\nfunction settle<T, E>(asyncResult: AsyncResult<T, E>): Promise<Result<T, E>> {\n return (async () => await asyncResult)();\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAqCA,SAAgB,aACd,QACA,UACwB;CACxB,OAAO,OAAO,MAA8B;EAC1C,KAAK,UAAUA,GAAa,KAAK;EACjC,MAAM,UAAUC,IAAc,KAAK;EACnC,SAAS,UAAUA,IAAc,SAAS,KAAK,CAAC;CAClD,CAAC;AACH;;;;;;;;;;;;AAaA,SAAgB,eAAqB,QAA8C;CACjF,OAAO,OAAO,KAAK,IAAIC,KAAG,OAAO,KAAK,IAAIC,MAAI,OAAO,KAAK;AAC5D;;;;;;;;;;;;;;;AAgBA,SAAgB,kBACd,aACA,UAC6B;CAC7B,OAAOC,YAAsB,gBAAgB,OAAO,WAAW,CAAC,CAAC,CAAC,SAAS,WACzE,aAAa,QAAQ,QAAQ,CAC/B;AACF;;;;;;;;;;;;;AAcA,SAAgB,oBACd,aACmB;CACnB,OAAO,gBAAgB,QAAQ,QAAQ,WAAW,CAAC,CAAC,CAAC,SAAS,WAAW,eAAe,MAAM,CAAC;AACjG;AAEA,SAAS,OAAa,aAAuD;CAC3E,QAAQ,YAAY,MAAM,YAAA,CAAa;AACzC"}
1
+ {"version":3,"file":"index.mjs","names":["neverthrowOk","neverthrowErr","NeverthrowResultAsync"],"sources":["../src/index.ts"],"sourcesContent":["// @unthrown/neverthrow — interop between unthrown's `Result`/`AsyncResult` and\n// neverthrow's `Result`/`ResultAsync`.\n//\n// neverthrow has two channels (`Ok`/`Err`), so it cannot represent unthrown's\n// third one. Coming *in*, every neverthrow result is an `Ok` or `Err` — never a\n// `Defect`. Going *out*, a `Defect` has nowhere to live, so `toNeverthrow`\n// forces you to triage it with `onDefect` (Thesis #3): no Defect is ever\n// silently folded into your domain error type.\n//\n// import { Ok } from \"unthrown\";\n// import { toNeverthrow, fromNeverthrow } from \"@unthrown/neverthrow\";\n//\n// toNeverthrow(Ok(1), (cause) => ({ _tag: \"Bug\", cause }));\n// fromNeverthrow(neverthrowOk(1)); // Result<number, never>\n\nimport {\n err as neverthrowErr,\n ok as neverthrowOk,\n ResultAsync as NeverthrowResultAsync,\n} from \"neverthrow\";\nimport type { Result as NeverthrowResult } from \"neverthrow\";\nimport { Err, fromSafePromise, Ok } from \"unthrown\";\nimport type { AsyncResult, Result } from \"unthrown\";\n\n/**\n * Convert a `Result` into a neverthrow `Result`, triaging any Defect.\n *\n * @remarks\n * neverthrow has no Defect channel, so `onDefect` **must** fold a `Defect`'s\n * cause into a modeled error `E` (an `Err`). `Ok → Ok`, `Err → Err`,\n * `Defect → Err(onDefect(cause))`.\n *\n * @typeParam T - the success value type.\n * @typeParam E - the modeled error type.\n * @param result - the result to convert.\n * @param onDefect - folds a Defect's unknown cause into a modeled `E`.\n */\nexport function toNeverthrow<T, E>(\n result: Result<T, E>,\n onDefect: (cause: unknown) => E,\n): NeverthrowResult<T, E> {\n return result.match<NeverthrowResult<T, E>>({\n ok: (value) => neverthrowOk(value),\n err: (error) => neverthrowErr(error),\n defect: (cause) => neverthrowErr(onDefect(cause)),\n });\n}\n\n/**\n * Convert a neverthrow `Result` into a `Result`.\n *\n * @remarks\n * `Ok → Ok`, `Err → Err`. neverthrow carries no Defect, so the result is never a\n * `Defect`.\n *\n * @typeParam T - the success value type.\n * @typeParam E - the modeled error type.\n * @param result - the neverthrow result to convert.\n */\nexport function fromNeverthrow<T, E>(result: NeverthrowResult<T, E>): Result<T, E> {\n return result.isOk() ? Ok(result.value) : Err(result.error);\n}\n\n/**\n * Convert an `AsyncResult` into a neverthrow `ResultAsync`, triaging any\n * Defect.\n *\n * @remarks\n * The async counterpart of {@link toNeverthrow}: `onDefect` is required for the\n * same reason. The `AsyncResult` is awaited (it never rejects) and each settled\n * `Result` is converted.\n *\n * @typeParam T - the success value type.\n * @typeParam E - the modeled error type.\n * @param asyncResult - the async result to convert.\n * @param onDefect - folds a Defect's unknown cause into a modeled `E`.\n */\nexport function toNeverthrowAsync<T, E>(\n asyncResult: AsyncResult<T, E>,\n onDefect: (cause: unknown) => E,\n): NeverthrowResultAsync<T, E> {\n return NeverthrowResultAsync.fromSafePromise(settle(asyncResult)).andThen((result) =>\n toNeverthrow(result, onDefect),\n );\n}\n\n/**\n * Convert a neverthrow `ResultAsync` into an `AsyncResult`.\n *\n * @remarks\n * The async counterpart of {@link fromNeverthrow}. A modeled `Err` stays an\n * `Err`; an *unexpected* rejection inside the neverthrow chain becomes a\n * `Defect`. The returned `AsyncResult` never throws when awaited.\n *\n * @typeParam T - the success value type.\n * @typeParam E - the modeled error type.\n * @param resultAsync - the neverthrow async result to convert.\n */\nexport function fromNeverthrowAsync<T, E>(\n resultAsync: NeverthrowResultAsync<T, E>,\n): AsyncResult<T, E> {\n return fromSafePromise(Promise.resolve(resultAsync)).flatMap((result) => fromNeverthrow(result));\n}\n\nfunction settle<T, E>(asyncResult: AsyncResult<T, E>): Promise<Result<T, E>> {\n return (async () => await asyncResult)();\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAqCA,SAAgB,aACd,QACA,UACwB;CACxB,OAAO,OAAO,MAA8B;EAC1C,KAAK,UAAUA,GAAa,KAAK;EACjC,MAAM,UAAUC,IAAc,KAAK;EACnC,SAAS,UAAUA,IAAc,SAAS,KAAK,CAAC;CAClD,CAAC;AACH;;;;;;;;;;;;AAaA,SAAgB,eAAqB,QAA8C;CACjF,OAAO,OAAO,KAAK,IAAI,GAAG,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK;AAC5D;;;;;;;;;;;;;;;AAgBA,SAAgB,kBACd,aACA,UAC6B;CAC7B,OAAOC,YAAsB,gBAAgB,OAAO,WAAW,CAAC,CAAC,CAAC,SAAS,WACzE,aAAa,QAAQ,QAAQ,CAC/B;AACF;;;;;;;;;;;;;AAcA,SAAgB,oBACd,aACmB;CACnB,OAAO,gBAAgB,QAAQ,QAAQ,WAAW,CAAC,CAAC,CAAC,SAAS,WAAW,eAAe,MAAM,CAAC;AACjG;AAEA,SAAS,OAAa,aAAuD;CAC3E,QAAQ,YAAY,MAAM,YAAA,CAAa;AACzC"}
package/docs/index.md CHANGED
@@ -12,7 +12,7 @@
12
12
  function fromNeverthrow<T, E>(result): Result<T, E>;
13
13
  ```
14
14
 
15
- Defined in: [index.ts:60](https://github.com/btravstack/unthrown/blob/1e34025e0177665dde9c50faca313fd1b95e5545/packages/neverthrow/src/index.ts#L60)
15
+ Defined in: [index.ts:60](https://github.com/btravstack/unthrown/blob/fa4c17ddc81bb2075e8f48dfcc49e5e04d951dd1/packages/neverthrow/src/index.ts#L60)
16
16
 
17
17
  Convert a neverthrow `Result` into a `Result`.
18
18
 
@@ -35,7 +35,7 @@ Convert a neverthrow `Result` into a `Result`.
35
35
 
36
36
  #### Remarks
37
37
 
38
- `ok → Ok`, `err → Err`. neverthrow carries no defect, so the result is never a
38
+ `Ok → Ok`, `Err → Err`. neverthrow carries no Defect, so the result is never a
39
39
  `Defect`.
40
40
 
41
41
  ***
@@ -46,7 +46,7 @@ Convert a neverthrow `Result` into a `Result`.
46
46
  function fromNeverthrowAsync<T, E>(resultAsync): AsyncResult<T, E>;
47
47
  ```
48
48
 
49
- Defined in: [index.ts:99](https://github.com/btravstack/unthrown/blob/1e34025e0177665dde9c50faca313fd1b95e5545/packages/neverthrow/src/index.ts#L99)
49
+ Defined in: [index.ts:99](https://github.com/btravstack/unthrown/blob/fa4c17ddc81bb2075e8f48dfcc49e5e04d951dd1/packages/neverthrow/src/index.ts#L99)
50
50
 
51
51
  Convert a neverthrow `ResultAsync` into an `AsyncResult`.
52
52
 
@@ -81,9 +81,9 @@ The async counterpart of [fromNeverthrow](#fromneverthrow). A modeled `Err` stay
81
81
  function toNeverthrow<T, E>(result, onDefect): Result<T, E>;
82
82
  ```
83
83
 
84
- Defined in: [index.ts:38](https://github.com/btravstack/unthrown/blob/1e34025e0177665dde9c50faca313fd1b95e5545/packages/neverthrow/src/index.ts#L38)
84
+ Defined in: [index.ts:38](https://github.com/btravstack/unthrown/blob/fa4c17ddc81bb2075e8f48dfcc49e5e04d951dd1/packages/neverthrow/src/index.ts#L38)
85
85
 
86
- Convert a `Result` into a neverthrow `Result`, triaging any defect.
86
+ Convert a `Result` into a neverthrow `Result`, triaging any Defect.
87
87
 
88
88
  #### Type Parameters
89
89
 
@@ -97,7 +97,7 @@ Convert a `Result` into a neverthrow `Result`, triaging any defect.
97
97
  | Parameter | Type | Description |
98
98
  | ------ | ------ | ------ |
99
99
  | `result` | `Result`&lt;`T`, `E`&gt; | the result to convert. |
100
- | `onDefect` | (`cause`) => `E` | folds a defect's unknown cause into a modeled `E`. |
100
+ | `onDefect` | (`cause`) => `E` | folds a Defect's unknown cause into a modeled `E`. |
101
101
 
102
102
  #### Returns
103
103
 
@@ -105,9 +105,9 @@ Convert a `Result` into a neverthrow `Result`, triaging any defect.
105
105
 
106
106
  #### Remarks
107
107
 
108
- neverthrow has no defect channel, so `onDefect` **must** fold a `Defect`'s
109
- cause into a modeled error `E` (an `Err`). `Ok → ok`, `Err → err`,
110
- `Defect → err(onDefect(cause))`.
108
+ neverthrow has no Defect channel, so `onDefect` **must** fold a `Defect`'s
109
+ cause into a modeled error `E` (an `Err`). `Ok → Ok`, `Err → Err`,
110
+ `Defect → Err(onDefect(cause))`.
111
111
 
112
112
  ***
113
113
 
@@ -117,10 +117,10 @@ cause into a modeled error `E` (an `Err`). `Ok → ok`, `Err → err`,
117
117
  function toNeverthrowAsync<T, E>(asyncResult, onDefect): ResultAsync<T, E>;
118
118
  ```
119
119
 
120
- Defined in: [index.ts:78](https://github.com/btravstack/unthrown/blob/1e34025e0177665dde9c50faca313fd1b95e5545/packages/neverthrow/src/index.ts#L78)
120
+ Defined in: [index.ts:78](https://github.com/btravstack/unthrown/blob/fa4c17ddc81bb2075e8f48dfcc49e5e04d951dd1/packages/neverthrow/src/index.ts#L78)
121
121
 
122
122
  Convert an `AsyncResult` into a neverthrow `ResultAsync`, triaging any
123
- defect.
123
+ Defect.
124
124
 
125
125
  #### Type Parameters
126
126
 
@@ -134,7 +134,7 @@ defect.
134
134
  | Parameter | Type | Description |
135
135
  | ------ | ------ | ------ |
136
136
  | `asyncResult` | `AsyncResult`&lt;`T`, `E`&gt; | the async result to convert. |
137
- | `onDefect` | (`cause`) => `E` | folds a defect's unknown cause into a modeled `E`. |
137
+ | `onDefect` | (`cause`) => `E` | folds a Defect's unknown cause into a modeled `E`. |
138
138
 
139
139
  #### Returns
140
140
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unthrown/neverthrow",
3
- "version": "0.3.0",
3
+ "version": "1.0.0",
4
4
  "description": "neverthrow interop for unthrown",
5
5
  "keywords": [
6
6
  "errors-as-values",
@@ -43,7 +43,7 @@
43
43
  "./package.json": "./package.json"
44
44
  },
45
45
  "dependencies": {
46
- "unthrown": "0.3.0"
46
+ "unthrown": "1.0.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/node": "24.13.2",