skyr 1.1.0 → 1.1.1

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 (40) hide show
  1. package/README.md +62 -44
  2. package/esm/_internal/handlers.js +1 -1
  3. package/esm/async_result.d.ts +3 -3
  4. package/esm/async_result.js +2 -2
  5. package/esm/fn/fn.js +12 -12
  6. package/esm/fn/use.d.ts +2 -2
  7. package/esm/operators/inspect.d.ts +1 -1
  8. package/esm/operators/inspect.js +1 -1
  9. package/esm/operators/inspect_err.d.ts +1 -1
  10. package/esm/operators/inspect_err.js +1 -1
  11. package/esm/operators/map.d.ts +1 -1
  12. package/esm/operators/map.js +1 -1
  13. package/esm/operators/map_err.d.ts +2 -2
  14. package/esm/operators/map_err.js +2 -2
  15. package/esm/operators/unwrap.d.ts +1 -1
  16. package/esm/operators/unwrap.js +1 -1
  17. package/esm/panic.d.ts +2 -2
  18. package/esm/panic.js +2 -2
  19. package/esm/result.d.ts +2 -2
  20. package/esm/result.d.ts.map +1 -1
  21. package/package.json +1 -1
  22. package/script/_internal/handlers.js +1 -1
  23. package/script/async_result.d.ts +3 -3
  24. package/script/async_result.js +2 -2
  25. package/script/fn/fn.js +11 -11
  26. package/script/fn/use.d.ts +2 -2
  27. package/script/operators/inspect.d.ts +1 -1
  28. package/script/operators/inspect.js +1 -1
  29. package/script/operators/inspect_err.d.ts +1 -1
  30. package/script/operators/inspect_err.js +1 -1
  31. package/script/operators/map.d.ts +1 -1
  32. package/script/operators/map.js +1 -1
  33. package/script/operators/map_err.d.ts +2 -2
  34. package/script/operators/map_err.js +2 -2
  35. package/script/operators/unwrap.d.ts +1 -1
  36. package/script/operators/unwrap.js +1 -1
  37. package/script/panic.d.ts +2 -2
  38. package/script/panic.js +2 -2
  39. package/script/result.d.ts +2 -2
  40. package/script/result.d.ts.map +1 -1
package/README.md CHANGED
@@ -57,19 +57,19 @@ Results are plain objects with a `_tag` discriminant:
57
57
 
58
58
  The `cause` field is `undefined` when not provided.
59
59
 
60
- Every Result comes with methods for transforming and inspecting it type `.` in
60
+ Every Result comes with methods for transforming and inspecting it. Type `.` in
61
61
  your IDE and see what's available.
62
62
 
63
63
  ### Letting TypeScript Infer Result Types
64
64
 
65
65
  There's a subtlety with the example above. Without an explicit return type
66
66
  annotation, TypeScript infers the return type as
67
- `Result<string, never> | Result<never, "INVALID_EMAIL">` a union of two
67
+ `Result<string, never> | Result<never, "INVALID_EMAIL">`, a union of two
68
68
  separate Result types rather than a single unified
69
69
  `Result<string, "INVALID_EMAIL">`.
70
70
 
71
71
  You could fix this by adding a return type annotation, but it's generally safer
72
- to let TypeScript infer return types whenever possible annotations can drift
72
+ to let TypeScript infer return types whenever possible. Annotations can drift
73
73
  out of sync with the implementation and mask bugs.
74
74
 
75
75
  Instead, wrap the function with `fn()`:
@@ -87,7 +87,7 @@ const validateEmail = R.fn((email: string) => {
87
87
  ```
88
88
 
89
89
  `fn()` collapses all the Result branches into a single, clean `Result<T, E>`
90
- type. No annotation needed the ok value type and all possible error codes are
90
+ type. No annotation needed; the ok value type and all possible error codes are
91
91
  inferred automatically.
92
92
 
93
93
  This is the simplest use of `fn()`. It also supports
@@ -123,7 +123,7 @@ considered a Result if it's a non-null object with `_tag` equal to `"Ok"` or
123
123
  ### Method Chaining
124
124
 
125
125
  Every Result has methods for transformation, error handling, and value
126
- extraction. Chain them directly no imports or special syntax needed:
126
+ extraction. Chain them directly, no imports or special syntax needed:
127
127
 
128
128
  ```typescript
129
129
  const message = validateEmail("User@Example.com")
@@ -137,15 +137,14 @@ const message = validateEmail("User@Example.com")
137
137
  console.log(message); // "Welcome, user@example.com!"
138
138
  ```
139
139
 
140
- Methods skip over errors automatically if `validateEmail` returns an error,
141
- the `.map()` calls are never executed, and the error flows straight to
142
- `.match()`.
140
+ Methods skip over errors automatically. If `validateEmail` returns an error, the
141
+ `.map()` calls are never executed and the error flows straight to `.match()`.
143
142
 
144
143
  ### Async Propagation
145
144
 
146
- When any step returns a `Promise`, the result becomes an `AsyncResult` a
145
+ When any step returns a `Promise`, the result becomes an `AsyncResult`, a
147
146
  wrapper around `Promise<Result>` with the same methods. This is called **async
148
- poison** once async, always async (until you `await`).
147
+ poison**: once async, always async (until you `await`).
149
148
 
150
149
  ```typescript
151
150
  const result = validateEmail("user@example.com") // Result<string, ...>
@@ -154,7 +153,7 @@ const result = validateEmail("user@example.com") // Result<string, ...>
154
153
  // Type: AsyncResult<string, ...>
155
154
 
156
155
  const finalResult = await result;
157
- // Type: Result<string, ...> back to sync, methods available again
156
+ // Type: Result<string, ...> (back to sync)
158
157
  ```
159
158
 
160
159
  `AsyncResult` is `PromiseLike`, so you can `await` it to get back a sync
@@ -181,14 +180,16 @@ const message = R.pipe(
181
180
  ```
182
181
 
183
182
  Standalone operators accept both `Result` and `Promise<Result>` as input and
184
- propagate async automatically they work interchangeably with both styles.
183
+ propagate async automatically and work interchangeably with both styles.
185
184
 
186
- ### Panics: Catching Programmer Errors
185
+ ### Panics: Unexpected Throws
187
186
 
188
- Callbacks passed to `map`, `mapErr`, and `match` are expected to be pure
189
- transformation functions. If a callback **throws synchronously**, that's a
190
- programmer error a bug, not a domain error. skyr wraps these in a `Panic`
191
- error to make them instantly recognizable:
187
+ If your code calls something that might throw or reject, or you're unsure
188
+ whether it could, wrap it with `fromThrowable()` to convert it into a Result
189
+ safely. This is the recommended approach for any code you don't fully control.
190
+
191
+ If a callback passed to `map`, `mapErr`, or `match` throws synchronously without
192
+ being wrapped, a `Panic` is thrown, halting execution immediately unless caught:
192
193
 
193
194
  ```typescript
194
195
  R.ok(42).map(() => {
@@ -201,11 +202,12 @@ R.ok(42).map(() => {
201
202
  `Panic` extends `Error`, so you get a full stack trace. Catch it at the top
202
203
  level with `instanceof R.Panic` if needed.
203
204
 
204
- **Promise rejections** are different they represent the outside world failing
205
- (network errors, etc.) and are captured as `UNKNOWN_ERR` results, not Panics.
206
-
207
- If your callback calls code that might throw, wrap it with `fromThrowable()` to
208
- convert it into a Result safely.
205
+ **Async functions** (Promises) returned from callbacks are automatically wrapped
206
+ with `fromThrowable` implicitly, so rejections become `UNKNOWN_ERR` results
207
+ instead of Panics. However, if you use multiple async functions, all their
208
+ errors will share the same `UNKNOWN_ERR` code, making it impossible to
209
+ distinguish between them. Wrapping each one with `fromThrowable` and a dedicated
210
+ error code is the recommended approach.
209
211
 
210
212
  ## Methods
211
213
 
@@ -224,7 +226,7 @@ R.ok(5)
224
226
  ```
225
227
 
226
228
  If `fn` returns a `Result`, it's automatically flattened (no nested Results). If
227
- it returns a `Promise`, the result becomes an `AsyncResult` the Promise is
229
+ it returns a `Promise`, the result becomes an `AsyncResult`. The Promise is
228
230
  automatically handled like `fromThrowable`: resolved values become ok, rejected
229
231
  Promises become `UNKNOWN_ERR`.
230
232
 
@@ -232,7 +234,7 @@ Promises become `UNKNOWN_ERR`.
232
234
 
233
235
  Transforms or recovers from errors. Has two forms:
234
236
 
235
- **Function form** transform all errors:
237
+ **Function form** - transform all errors:
236
238
 
237
239
  ```typescript
238
240
  R.err("NOT_FOUND", "User not found")
@@ -240,7 +242,7 @@ R.err("NOT_FOUND", "User not found")
240
242
  // Result<never, "DEFAULT_ERROR">
241
243
  ```
242
244
 
243
- **Handler object** handle specific error codes with autocomplete:
245
+ **Handler object** - handle specific error codes with autocomplete:
244
246
 
245
247
  ```typescript
246
248
  type AppError = "NOT_FOUND" | "TIMEOUT" | "AUTH_FAILED";
@@ -289,7 +291,7 @@ validateEmail("user@example.com")
289
291
  .map((email) => email.toLowerCase());
290
292
  ```
291
293
 
292
- The callback's return value is ignored the original Result is always returned
294
+ The callback's return value is ignored; the original Result is always returned
293
295
  unchanged. If the callback throws or the returned Promise rejects, the error is
294
296
  silently swallowed and the original Result passes through. Side effects should
295
297
  never break the pipeline.
@@ -363,14 +365,33 @@ safeParse("nope"); // Err("PARSE_ERROR")
363
365
 
364
366
  ## Dependency Injection with `fn()`
365
367
 
366
- For larger applications, `fn()` accepts a generator function to enable
367
- railway-style programming with dependency injection. Inside the generator,
368
- `yield*` unwraps Results (short-circuiting on failure) and `yield* R.use(Dep)`
369
- acquires dependencies. Dependencies are tracked by the type system and must be
370
- injected before the function can be called.
368
+ `fn()` is a function builder. You pass it a generator and get back a function
369
+ you can call just like any other. The difference is that inside the generator
370
+ you get two superpowers:
371
+
372
+ 1. **Dependency requests** - `yield* R.use(Dep)` gives you an implementation of
373
+ a dependency without worrying about how to acquire it. Think of it like a
374
+ function parameter, except you don't have to pass it in at the call site.
375
+ When one `fn()` function calls another, unmet dependencies propagate up
376
+ automatically, no prop drilling required. You can also choose to supply some
377
+ dependencies but not all, and the rest keep propagating.
378
+
379
+ 2. **Result unwrapping** - `yield* someResult` extracts the success value from
380
+ any `Result` or `AsyncResult`. If it's an error, the function short-circuits
381
+ (early return) and the error propagates to the caller, just like the
382
+ non-generator version (`fn(() => ...)`).
371
383
 
372
- Both `ok()` and `err()` are iterable, which is what makes `yield*` work for
373
- Result unwrapping in generators.
384
+ The return type of an `fn()` function is `Fn<Args, Success, Errors, Deps>`:
385
+
386
+ - **Args** - the parameter list of your generator (e.g. `(email: string)` →
387
+ `[string]`)
388
+ - **Success** - the unwrapped success type
389
+ - **Errors** - a union of all error codes, accumulated from every `yield*` call
390
+ - **Deps** - a union of all unmet dependencies, accumulated from every
391
+ `yield* R.use()` call
392
+
393
+ The `Fn` you get back is only callable once all dependencies are injected (via
394
+ `.inject()`), at which point the `Deps` part of the type becomes `never`.
374
395
 
375
396
  ### Declaring Dependencies
376
397
 
@@ -389,9 +410,6 @@ const Logger = R.dependency<{
389
410
 
390
411
  ### Creating Functions
391
412
 
392
- Use `fn()` with a generator. Inside, `yield*` unwraps Results (short-circuiting
393
- on failure) and `yield* R.use(Dep)` acquires dependencies:
394
-
395
413
  ```typescript
396
414
  const GetUser = R.fn(function* (email: string) {
397
415
  const db = yield* R.use(Database);
@@ -411,9 +429,10 @@ const GetUser = R.fn(function* (email: string) {
411
429
 
412
430
  Key points:
413
431
 
414
- - `yield* R.use(Database)` acquires a dependency from the DI context
415
- - `yield* validateEmail(email)` unwraps a Result; short-circuits on failure
416
- - `yield* R.fromThrowable(...)` unwraps an async Result
432
+ - `yield* R.use(Database)` - acquires a dependency from the DI context
433
+ - `yield* validateEmail(email)` - unwraps a Result; short-circuits on failure
434
+ - `yield* R.fromThrowable(...)` - catches throws/rejections, converting them to
435
+ a Result, then unwraps it
417
436
  - Error types accumulate automatically across all `yield*` calls
418
437
  - Dependency types accumulate automatically across all `yield* R.use()` calls
419
438
 
@@ -427,7 +446,7 @@ const getUser = GetUser.inject(
427
446
  Logger.impl({ info: console.log }),
428
447
  );
429
448
 
430
- // Now callable all dependencies satisfied
449
+ // All dependencies satisfied, now callable
431
450
  const result = await getUser("user@example.com");
432
451
  ```
433
452
 
@@ -488,9 +507,8 @@ const LoginUser = R.fn(function* (email: string, password: string) {
488
507
  // Dependencies: Logger | Database (Database inherited from CheckPermissions)
489
508
  ```
490
509
 
491
- The two-step pattern `yield* R.use(Fn)` then `yield* callable(args)`
492
- separates dependency resolution from execution, keeping the control flow
493
- explicit.
510
+ The two-step pattern, `yield* R.use(Fn)` then `yield* callable(args)`, separates
511
+ dependency resolution from execution, keeping the control flow explicit.
494
512
 
495
513
  ## API Reference
496
514
 
@@ -529,7 +547,7 @@ explicit.
529
547
  `AsyncResult<T, E>` wraps a `Promise<Result<T, E>>` and exposes the same methods
530
548
  as `Result`. All methods return `AsyncResult` (async poison), except terminal
531
549
  operations (`.match()`, `.unwrap()`, `.unwrapOr()`) which return `Promise`.
532
- `AsyncResult` is `PromiseLike` `await` it to get a sync `Result`.
550
+ `AsyncResult` is `PromiseLike`; `await` it to get a sync `Result`.
533
551
 
534
552
  ### Standalone Operators (for `pipe()`)
535
553
 
@@ -97,7 +97,7 @@ export function handleInspect(result, fn) {
97
97
  }
98
98
  }
99
99
  catch {
100
- // Swallow side effects never break the pipeline
100
+ // Swallow; side effects never break the pipeline
101
101
  }
102
102
  return result;
103
103
  }
@@ -1,8 +1,8 @@
1
1
  /**
2
- * AsyncResult a Promise<Result<T, E>> with chainable methods.
2
+ * AsyncResult: a Promise<Result<T, E>> with chainable methods.
3
3
  *
4
4
  * All methods return AsyncResult (async poison), except terminal operations
5
- * (match, unwrap, unwrapOr) which return Promise. AsyncResult is PromiseLike
5
+ * (match, unwrap, unwrapOr) which return Promise. AsyncResult is PromiseLike -
6
6
  * await it to get back a sync Result with all its methods.
7
7
  */
8
8
  import type { Err, Result } from "./result.js";
@@ -14,7 +14,7 @@ import type { HandlerErr, HandlerOk, InferHandlerReturns } from "./_internal/typ
14
14
  * All methods return `AsyncResult` (async poison). Terminal operations
15
15
  * (`match`, `unwrap`, `unwrapOr`) return `Promise`.
16
16
  *
17
- * Implements `PromiseLike` `await` it to get back a sync `Result`.
17
+ * Implements `PromiseLike`; `await` it to get back a sync `Result`.
18
18
  */
19
19
  export type AsyncResult<T, E extends string> = PromiseLike<Result<T, E>> & {
20
20
  map<T2, E2 extends string>(fn: (value: T) => Promise<Result<T2, E2>>): AsyncResult<T2, E | E2 | "UNKNOWN_ERR">;
@@ -1,8 +1,8 @@
1
1
  /**
2
- * AsyncResult a Promise<Result<T, E>> with chainable methods.
2
+ * AsyncResult: a Promise<Result<T, E>> with chainable methods.
3
3
  *
4
4
  * All methods return AsyncResult (async poison), except terminal operations
5
- * (match, unwrap, unwrapOr) which return Promise. AsyncResult is PromiseLike
5
+ * (match, unwrap, unwrapOr) which return Promise. AsyncResult is PromiseLike -
6
6
  * await it to get back a sync Result with all its methods.
7
7
  */
8
8
  // ============================================================================
package/esm/fn/fn.js CHANGED
@@ -23,9 +23,9 @@ function resolveDependency(request, deps, gen) {
23
23
  return gen.next(deps[request.key]);
24
24
  }
25
25
  // ============================================================================
26
- // Generator Execution Shared Helpers
26
+ // Generator Execution - Shared Helpers
27
27
  // ============================================================================
28
- /** Handle a UseRequest resolves dependencies or creates contextualized callables. */
28
+ /** Handle a UseRequest. Resolves dependencies or creates contextualized callables. */
29
29
  function handleUseRequest(request, gen, deps) {
30
30
  if (request.type === "dependency") {
31
31
  const depRequest = {
@@ -35,7 +35,7 @@ function handleUseRequest(request, gen, deps) {
35
35
  };
36
36
  return resolveDependency(depRequest, deps, gen);
37
37
  }
38
- // type === "fn" create contextualized callable
38
+ // type === "fn", create contextualized callable
39
39
  const target = request.target;
40
40
  const contextualizedCallable = (...callArgs) => {
41
41
  const mergedDeps = { ...deps, ...target._fn._injectedDeps };
@@ -80,14 +80,14 @@ function runGenerator(generator, args, deps) {
80
80
  if (isResult(yielded)) {
81
81
  if (isErr(yielded))
82
82
  return yielded;
83
- // Ok with Promise value transition to async
83
+ // Ok with Promise value, transition to async
84
84
  if (isOk(yielded) && yielded.value instanceof Promise) {
85
85
  return asyncResult(runGeneratorAsync(gen, yielded.value, deps));
86
86
  }
87
87
  result = gen.next(isOk(yielded) ? yielded.value : yielded);
88
88
  continue;
89
89
  }
90
- // Bare Promise transition to async
90
+ // Bare Promise, transition to async
91
91
  if (yielded instanceof Promise) {
92
92
  return asyncResult(runGeneratorAsync(gen, yielded, deps));
93
93
  }
@@ -146,7 +146,7 @@ function createFn(generator, injectedDeps = {}) {
146
146
  // The callable and metadata use `any` extensively because TypeScript can't
147
147
  // express the relationship between generator yield types, dependency resolution,
148
148
  // and the final callable signature. The public type safety comes from the Fn<>
149
- // type wrapper and the fn() overload signatures this internal plumbing is
149
+ // type wrapper and the fn() overload signatures. This internal plumbing is
150
150
  // invisible to consumers.
151
151
  const callable = (...args) => {
152
152
  const output = runGenerator(generator, args, injectedDeps);
@@ -160,7 +160,7 @@ function createFn(generator, injectedDeps = {}) {
160
160
  // Builder method: .inject()
161
161
  callable.inject = (...impls) => injectDeps(callable, impls);
162
162
  // Make Fn iterable so `yield* use(SomeFn)` works in parent generators.
163
- // This generator yields nothing and immediately returns the callable
163
+ // This generator yields nothing and immediately returns the callable.
164
164
  // `yield*` on a generator that only returns (no yields) evaluates to the
165
165
  // return value, so `const f = yield* use(Fn)` gives back the callable.
166
166
  // deno-lint-ignore require-yield
@@ -175,7 +175,7 @@ function createFn(generator, injectedDeps = {}) {
175
175
  /**
176
176
  * Creates a function with optional dependency injection and Result unwrapping.
177
177
  *
178
- * **Regular function** collapses Result return type branches into a single
178
+ * **Regular function** collapses Result return type branches into a single
179
179
  * `Result<T, E>` (no annotation needed):
180
180
  * ```ts
181
181
  * const divide = R.fn((a: number, b: number) =>
@@ -184,7 +184,7 @@ function createFn(generator, injectedDeps = {}) {
184
184
  * // (a: number, b: number) => Result<number, "DIV_ZERO">
185
185
  * ```
186
186
  *
187
- * **Generator function** enables `yield*` for Result unwrapping (short-circuits
187
+ * **Generator function** enables `yield*` for Result unwrapping (short-circuits
188
188
  * on error) and `yield* R.use(Dep)` for dependency injection:
189
189
  * ```ts
190
190
  * const GetUser = R.fn(function* (email: string) {
@@ -201,7 +201,7 @@ function createFn(generator, injectedDeps = {}) {
201
201
  */
202
202
  // Detect generator functions via their constructor (immune to minification).
203
203
  // This uses `instanceof`, which assumes the generator is from the same realm
204
- // (same global context) as this module. Safe in practice users always write
204
+ // (same global context) as this module. Safe in practice; users always write
205
205
  // `fn(function* () { ... })` inline, never across iframes or VM contexts.
206
206
  const GeneratorFunction = (function* () { }).constructor;
207
207
  // Implementation
@@ -212,8 +212,8 @@ export function fn(funcOrGenerator) {
212
212
  }
213
213
  // Regular function: return as-is. The type overload handles
214
214
  // collapsing Result<T, never> | Result<never, E> into Result<T, E>.
215
- // No Fn wrapper needed no generators, no DI, no runtime overhead.
215
+ // No Fn wrapper needed. No generators, no DI, no runtime overhead.
216
216
  return funcOrGenerator;
217
217
  }
218
- // Used by inject.ts not re-exported from mod.ts
218
+ // Used by inject.ts, not re-exported from mod.ts
219
219
  export { createFn };
package/esm/fn/use.d.ts CHANGED
@@ -3,8 +3,8 @@ import type { ContextualizedCallable, Dependency, Fn, UseDependencyRequest, UseF
3
3
  /**
4
4
  * Acquires a dependency or nested Fn inside a generator function.
5
5
  *
6
- * - `yield* R.use(Database)` returns the dependency value
7
- * - `yield* R.use(ChildFn)` returns a contextualized callable that inherits
6
+ * - `yield* R.use(Database)` returns the dependency value
7
+ * - `yield* R.use(ChildFn)` returns a contextualized callable that inherits
8
8
  * the parent's dependency context
9
9
  *
10
10
  * For unwrapping Results, use plain `yield*` instead (no `use()` needed).
@@ -22,7 +22,7 @@ type InspectOperator = <R extends AnyResult, U>(fn: (value: InferOk<R>) => U) =>
22
22
  * Runs a side effect on the ok value without changing the Result.
23
23
  *
24
24
  * The callback's return value is ignored. If the callback throws or
25
- * returns a rejected Promise, the error is silently swallowed — side
25
+ * returns a rejected Promise, the error is silently swallowed. Side
26
26
  * effects never break the pipeline.
27
27
  *
28
28
  * @example
@@ -5,7 +5,7 @@ import { asyncResult } from "../async_result.js";
5
5
  * Runs a side effect on the ok value without changing the Result.
6
6
  *
7
7
  * The callback's return value is ignored. If the callback throws or
8
- * returns a rejected Promise, the error is silently swallowed — side
8
+ * returns a rejected Promise, the error is silently swallowed. Side
9
9
  * effects never break the pipeline.
10
10
  *
11
11
  * @example
@@ -24,7 +24,7 @@ type InspectErrOperator = <R extends AnyResult, U>(fn: (err: Extract<Awaited<R>,
24
24
  * Runs a side effect on the error without changing the Result.
25
25
  *
26
26
  * The callback's return value is ignored. If the callback throws or
27
- * returns a rejected Promise, the error is silently swallowed — side
27
+ * returns a rejected Promise, the error is silently swallowed. Side
28
28
  * effects never break the pipeline.
29
29
  *
30
30
  * @example
@@ -5,7 +5,7 @@ import { asyncResult } from "../async_result.js";
5
5
  * Runs a side effect on the error without changing the Result.
6
6
  *
7
7
  * The callback's return value is ignored. If the callback throws or
8
- * returns a rejected Promise, the error is silently swallowed — side
8
+ * returns a rejected Promise, the error is silently swallowed. Side
9
9
  * effects never break the pipeline.
10
10
  *
11
11
  * @example
@@ -30,7 +30,7 @@ type MapOperator = <R extends AnyResult, U>(fn: (value: InferOk<R>) => U) => (re
30
30
  * Transforms the ok value. Skips if the result is an error.
31
31
  *
32
32
  * If `fn` returns a Result, it's automatically flattened (no nesting).
33
- * If `fn` returns a Promise, the pipeline becomes async resolved values
33
+ * If `fn` returns a Promise, the pipeline becomes async. Resolved values
34
34
  * become ok, rejections become `UNKNOWN_ERR`.
35
35
  *
36
36
  * Throws {@link Panic} if `fn` throws synchronously.
@@ -5,7 +5,7 @@ import { asyncResult } from "../async_result.js";
5
5
  * Transforms the ok value. Skips if the result is an error.
6
6
  *
7
7
  * If `fn` returns a Result, it's automatically flattened (no nesting).
8
- * If `fn` returns a Promise, the pipeline becomes async resolved values
8
+ * If `fn` returns a Promise, the pipeline becomes async. Resolved values
9
9
  * become ok, rejections become `UNKNOWN_ERR`.
10
10
  *
11
11
  * Throws {@link Panic} if `fn` throws synchronously.
@@ -66,12 +66,12 @@ type MapErrOperator = {
66
66
  /**
67
67
  * Transforms or recovers from errors. Has two forms:
68
68
  *
69
- * **Function form** transform all errors:
69
+ * **Function form** transforms all errors:
70
70
  * ```ts
71
71
  * R.mapErr(e => R.err("DEFAULT_ERROR", e.message))
72
72
  * ```
73
73
  *
74
- * **Handler object** handle specific error codes (with autocomplete):
74
+ * **Handler object** handles specific error codes (with autocomplete):
75
75
  * ```ts
76
76
  * R.mapErr({
77
77
  * NOT_FOUND: () => R.ok(guestUser), // recover with ok()
@@ -4,12 +4,12 @@ import { asyncResult } from "../async_result.js";
4
4
  /**
5
5
  * Transforms or recovers from errors. Has two forms:
6
6
  *
7
- * **Function form** transform all errors:
7
+ * **Function form** transforms all errors:
8
8
  * ```ts
9
9
  * R.mapErr(e => R.err("DEFAULT_ERROR", e.message))
10
10
  * ```
11
11
  *
12
- * **Handler object** handle specific error codes (with autocomplete):
12
+ * **Handler object** handles specific error codes (with autocomplete):
13
13
  * ```ts
14
14
  * R.mapErr({
15
15
  * NOT_FOUND: () => R.ok(guestUser), // recover with ok()
@@ -20,7 +20,7 @@ type UnwrapOperator = <R extends AnyResult>(result: R) => Match<[
20
20
  *
21
21
  * With `Promise<Result>` input, returns `Promise<T | undefined>`.
22
22
  *
23
- * Note: `unwrap` is a value (not a function call) use it without parentheses.
23
+ * Note: `unwrap` is a value, not a function call. Use it without parentheses.
24
24
  */
25
25
  export declare const unwrap: UnwrapOperator;
26
26
  export {};
@@ -10,7 +10,7 @@ import { isOk } from "../result.js";
10
10
  *
11
11
  * With `Promise<Result>` input, returns `Promise<T | undefined>`.
12
12
  *
13
- * Note: `unwrap` is a value (not a function call) use it without parentheses.
13
+ * Note: `unwrap` is a value, not a function call. Use it without parentheses.
14
14
  */
15
15
  export const unwrap = (result) => {
16
16
  const handle = (r) => {
package/esm/panic.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Thrown when an operator callback (`map`, `mapErr`, `match`) throws synchronously.
3
- * This signals a programmer error (a bug), not a domain error.
3
+ * This signals an unexpected throw, not a domain error.
4
4
  *
5
- * Extends `Error` catch with `instanceof R.Panic` if needed. The original
5
+ * Extends `Error`. Catch with `instanceof R.Panic` if needed. The original
6
6
  * error is available as `cause`. Promise rejections are different: they become
7
7
  * `UNKNOWN_ERR` results, not Panics.
8
8
  *
package/esm/panic.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Thrown when an operator callback (`map`, `mapErr`, `match`) throws synchronously.
3
- * This signals a programmer error (a bug), not a domain error.
3
+ * This signals an unexpected throw, not a domain error.
4
4
  *
5
- * Extends `Error` catch with `instanceof R.Panic` if needed. The original
5
+ * Extends `Error`. Catch with `instanceof R.Panic` if needed. The original
6
6
  * error is available as `cause`. Promise rejections are different: they become
7
7
  * `UNKNOWN_ERR` results, not Panics.
8
8
  *
package/esm/result.d.ts CHANGED
@@ -34,9 +34,9 @@ export type Err<C extends string> = {
34
34
  * transformations, error handling, and value extraction.
35
35
  */
36
36
  export interface ResultMethods<T, E extends string> {
37
- /** Type guard narrows to Ok with methods preserved. */
37
+ /** Type guard. Narrows to Ok with methods preserved. */
38
38
  isOk(): this is Ok<T> & ResultMethods<T, E>;
39
- /** Type guard narrows to Err with methods preserved. */
39
+ /** Type guard. Narrows to Err with methods preserved. */
40
40
  isErr(): this is Err<E> & ResultMethods<T, E>;
41
41
  /** Transform ok value; if fn returns Promise<Result>, becomes AsyncResult. */
42
42
  map<T2, E2 extends string>(fn: (value: T) => Promise<Result<T2, E2>>): AsyncResult<T2, E | E2 | "UNKNOWN_ERR">;
@@ -1 +1 @@
1
- {"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../src/result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,UAAU,EACV,SAAS,EACT,mBAAmB,EACnB,MAAM,sBAAsB,CAAC;AAO9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMrD;;;;;;;GAOG;AACH,MAAM,MAAM,EAAE,CAAC,CAAC,IAAI;IACnB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAClB,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;CAC3D,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS,MAAM,IAAI;IACnC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IACjB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;CACvD,CAAC;AAMF;;;GAGG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM;IACjD,yDAAyD;IACzD,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,EAAE,CA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CAoDjB,CAAC;AAMF,wEAAwE;AACxE,eAAO,MAAM,IAAI,GAAI,CAAC,EAAE,CAAC,SAAS,MAAM,EACvC,QAAQ,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAClB,MAAM,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAyB,CAAC;AAE1D,yEAAyE;AACzE,eAAO,MAAM,KAAK,GAAI,CAAC,EAAE,CAAC,SAAS,MAAM,EACxC,QAAQ,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAClB,MAAM,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAA0B,CAAC;AAE5D;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAM,CAAC,OAAO,EAAE,MAAM,CAI3B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skyr",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Type-safe error handling for TypeScript, inspired by Rust's Result type.",
5
5
  "keywords": [
6
6
  "result",
@@ -104,7 +104,7 @@ function handleInspect(result, fn) {
104
104
  }
105
105
  }
106
106
  catch {
107
- // Swallow side effects never break the pipeline
107
+ // Swallow; side effects never break the pipeline
108
108
  }
109
109
  return result;
110
110
  }
@@ -1,8 +1,8 @@
1
1
  /**
2
- * AsyncResult a Promise<Result<T, E>> with chainable methods.
2
+ * AsyncResult: a Promise<Result<T, E>> with chainable methods.
3
3
  *
4
4
  * All methods return AsyncResult (async poison), except terminal operations
5
- * (match, unwrap, unwrapOr) which return Promise. AsyncResult is PromiseLike
5
+ * (match, unwrap, unwrapOr) which return Promise. AsyncResult is PromiseLike -
6
6
  * await it to get back a sync Result with all its methods.
7
7
  */
8
8
  import type { Err, Result } from "./result.js";
@@ -14,7 +14,7 @@ import type { HandlerErr, HandlerOk, InferHandlerReturns } from "./_internal/typ
14
14
  * All methods return `AsyncResult` (async poison). Terminal operations
15
15
  * (`match`, `unwrap`, `unwrapOr`) return `Promise`.
16
16
  *
17
- * Implements `PromiseLike` `await` it to get back a sync `Result`.
17
+ * Implements `PromiseLike`; `await` it to get back a sync `Result`.
18
18
  */
19
19
  export type AsyncResult<T, E extends string> = PromiseLike<Result<T, E>> & {
20
20
  map<T2, E2 extends string>(fn: (value: T) => Promise<Result<T2, E2>>): AsyncResult<T2, E | E2 | "UNKNOWN_ERR">;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  /**
3
- * AsyncResult a Promise<Result<T, E>> with chainable methods.
3
+ * AsyncResult: a Promise<Result<T, E>> with chainable methods.
4
4
  *
5
5
  * All methods return AsyncResult (async poison), except terminal operations
6
- * (match, unwrap, unwrapOr) which return Promise. AsyncResult is PromiseLike
6
+ * (match, unwrap, unwrapOr) which return Promise. AsyncResult is PromiseLike -
7
7
  * await it to get back a sync Result with all its methods.
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
package/script/fn/fn.js CHANGED
@@ -27,9 +27,9 @@ function resolveDependency(request, deps, gen) {
27
27
  return gen.next(deps[request.key]);
28
28
  }
29
29
  // ============================================================================
30
- // Generator Execution Shared Helpers
30
+ // Generator Execution - Shared Helpers
31
31
  // ============================================================================
32
- /** Handle a UseRequest resolves dependencies or creates contextualized callables. */
32
+ /** Handle a UseRequest. Resolves dependencies or creates contextualized callables. */
33
33
  function handleUseRequest(request, gen, deps) {
34
34
  if (request.type === "dependency") {
35
35
  const depRequest = {
@@ -39,7 +39,7 @@ function handleUseRequest(request, gen, deps) {
39
39
  };
40
40
  return resolveDependency(depRequest, deps, gen);
41
41
  }
42
- // type === "fn" create contextualized callable
42
+ // type === "fn", create contextualized callable
43
43
  const target = request.target;
44
44
  const contextualizedCallable = (...callArgs) => {
45
45
  const mergedDeps = { ...deps, ...target._fn._injectedDeps };
@@ -84,14 +84,14 @@ function runGenerator(generator, args, deps) {
84
84
  if ((0, result_js_1.isResult)(yielded)) {
85
85
  if ((0, result_js_1.isErr)(yielded))
86
86
  return yielded;
87
- // Ok with Promise value transition to async
87
+ // Ok with Promise value, transition to async
88
88
  if ((0, result_js_1.isOk)(yielded) && yielded.value instanceof Promise) {
89
89
  return (0, async_result_js_1.asyncResult)(runGeneratorAsync(gen, yielded.value, deps));
90
90
  }
91
91
  result = gen.next((0, result_js_1.isOk)(yielded) ? yielded.value : yielded);
92
92
  continue;
93
93
  }
94
- // Bare Promise transition to async
94
+ // Bare Promise, transition to async
95
95
  if (yielded instanceof Promise) {
96
96
  return (0, async_result_js_1.asyncResult)(runGeneratorAsync(gen, yielded, deps));
97
97
  }
@@ -150,7 +150,7 @@ function createFn(generator, injectedDeps = {}) {
150
150
  // The callable and metadata use `any` extensively because TypeScript can't
151
151
  // express the relationship between generator yield types, dependency resolution,
152
152
  // and the final callable signature. The public type safety comes from the Fn<>
153
- // type wrapper and the fn() overload signatures this internal plumbing is
153
+ // type wrapper and the fn() overload signatures. This internal plumbing is
154
154
  // invisible to consumers.
155
155
  const callable = (...args) => {
156
156
  const output = runGenerator(generator, args, injectedDeps);
@@ -164,7 +164,7 @@ function createFn(generator, injectedDeps = {}) {
164
164
  // Builder method: .inject()
165
165
  callable.inject = (...impls) => (0, handlers_js_1.injectDeps)(callable, impls);
166
166
  // Make Fn iterable so `yield* use(SomeFn)` works in parent generators.
167
- // This generator yields nothing and immediately returns the callable
167
+ // This generator yields nothing and immediately returns the callable.
168
168
  // `yield*` on a generator that only returns (no yields) evaluates to the
169
169
  // return value, so `const f = yield* use(Fn)` gives back the callable.
170
170
  // deno-lint-ignore require-yield
@@ -179,7 +179,7 @@ function createFn(generator, injectedDeps = {}) {
179
179
  /**
180
180
  * Creates a function with optional dependency injection and Result unwrapping.
181
181
  *
182
- * **Regular function** collapses Result return type branches into a single
182
+ * **Regular function** collapses Result return type branches into a single
183
183
  * `Result<T, E>` (no annotation needed):
184
184
  * ```ts
185
185
  * const divide = R.fn((a: number, b: number) =>
@@ -188,7 +188,7 @@ function createFn(generator, injectedDeps = {}) {
188
188
  * // (a: number, b: number) => Result<number, "DIV_ZERO">
189
189
  * ```
190
190
  *
191
- * **Generator function** enables `yield*` for Result unwrapping (short-circuits
191
+ * **Generator function** enables `yield*` for Result unwrapping (short-circuits
192
192
  * on error) and `yield* R.use(Dep)` for dependency injection:
193
193
  * ```ts
194
194
  * const GetUser = R.fn(function* (email: string) {
@@ -205,7 +205,7 @@ function createFn(generator, injectedDeps = {}) {
205
205
  */
206
206
  // Detect generator functions via their constructor (immune to minification).
207
207
  // This uses `instanceof`, which assumes the generator is from the same realm
208
- // (same global context) as this module. Safe in practice users always write
208
+ // (same global context) as this module. Safe in practice; users always write
209
209
  // `fn(function* () { ... })` inline, never across iframes or VM contexts.
210
210
  const GeneratorFunction = (function* () { }).constructor;
211
211
  // Implementation
@@ -216,6 +216,6 @@ function fn(funcOrGenerator) {
216
216
  }
217
217
  // Regular function: return as-is. The type overload handles
218
218
  // collapsing Result<T, never> | Result<never, E> into Result<T, E>.
219
- // No Fn wrapper needed no generators, no DI, no runtime overhead.
219
+ // No Fn wrapper needed. No generators, no DI, no runtime overhead.
220
220
  return funcOrGenerator;
221
221
  }
@@ -3,8 +3,8 @@ import type { ContextualizedCallable, Dependency, Fn, UseDependencyRequest, UseF
3
3
  /**
4
4
  * Acquires a dependency or nested Fn inside a generator function.
5
5
  *
6
- * - `yield* R.use(Database)` returns the dependency value
7
- * - `yield* R.use(ChildFn)` returns a contextualized callable that inherits
6
+ * - `yield* R.use(Database)` returns the dependency value
7
+ * - `yield* R.use(ChildFn)` returns a contextualized callable that inherits
8
8
  * the parent's dependency context
9
9
  *
10
10
  * For unwrapping Results, use plain `yield*` instead (no `use()` needed).
@@ -22,7 +22,7 @@ type InspectOperator = <R extends AnyResult, U>(fn: (value: InferOk<R>) => U) =>
22
22
  * Runs a side effect on the ok value without changing the Result.
23
23
  *
24
24
  * The callback's return value is ignored. If the callback throws or
25
- * returns a rejected Promise, the error is silently swallowed — side
25
+ * returns a rejected Promise, the error is silently swallowed. Side
26
26
  * effects never break the pipeline.
27
27
  *
28
28
  * @example
@@ -8,7 +8,7 @@ const async_result_js_1 = require("../async_result.js");
8
8
  * Runs a side effect on the ok value without changing the Result.
9
9
  *
10
10
  * The callback's return value is ignored. If the callback throws or
11
- * returns a rejected Promise, the error is silently swallowed — side
11
+ * returns a rejected Promise, the error is silently swallowed. Side
12
12
  * effects never break the pipeline.
13
13
  *
14
14
  * @example
@@ -24,7 +24,7 @@ type InspectErrOperator = <R extends AnyResult, U>(fn: (err: Extract<Awaited<R>,
24
24
  * Runs a side effect on the error without changing the Result.
25
25
  *
26
26
  * The callback's return value is ignored. If the callback throws or
27
- * returns a rejected Promise, the error is silently swallowed — side
27
+ * returns a rejected Promise, the error is silently swallowed. Side
28
28
  * effects never break the pipeline.
29
29
  *
30
30
  * @example
@@ -8,7 +8,7 @@ const async_result_js_1 = require("../async_result.js");
8
8
  * Runs a side effect on the error without changing the Result.
9
9
  *
10
10
  * The callback's return value is ignored. If the callback throws or
11
- * returns a rejected Promise, the error is silently swallowed — side
11
+ * returns a rejected Promise, the error is silently swallowed. Side
12
12
  * effects never break the pipeline.
13
13
  *
14
14
  * @example
@@ -30,7 +30,7 @@ type MapOperator = <R extends AnyResult, U>(fn: (value: InferOk<R>) => U) => (re
30
30
  * Transforms the ok value. Skips if the result is an error.
31
31
  *
32
32
  * If `fn` returns a Result, it's automatically flattened (no nesting).
33
- * If `fn` returns a Promise, the pipeline becomes async resolved values
33
+ * If `fn` returns a Promise, the pipeline becomes async. Resolved values
34
34
  * become ok, rejections become `UNKNOWN_ERR`.
35
35
  *
36
36
  * Throws {@link Panic} if `fn` throws synchronously.
@@ -8,7 +8,7 @@ const async_result_js_1 = require("../async_result.js");
8
8
  * Transforms the ok value. Skips if the result is an error.
9
9
  *
10
10
  * If `fn` returns a Result, it's automatically flattened (no nesting).
11
- * If `fn` returns a Promise, the pipeline becomes async resolved values
11
+ * If `fn` returns a Promise, the pipeline becomes async. Resolved values
12
12
  * become ok, rejections become `UNKNOWN_ERR`.
13
13
  *
14
14
  * Throws {@link Panic} if `fn` throws synchronously.
@@ -66,12 +66,12 @@ type MapErrOperator = {
66
66
  /**
67
67
  * Transforms or recovers from errors. Has two forms:
68
68
  *
69
- * **Function form** transform all errors:
69
+ * **Function form** transforms all errors:
70
70
  * ```ts
71
71
  * R.mapErr(e => R.err("DEFAULT_ERROR", e.message))
72
72
  * ```
73
73
  *
74
- * **Handler object** handle specific error codes (with autocomplete):
74
+ * **Handler object** handles specific error codes (with autocomplete):
75
75
  * ```ts
76
76
  * R.mapErr({
77
77
  * NOT_FOUND: () => R.ok(guestUser), // recover with ok()
@@ -7,12 +7,12 @@ const async_result_js_1 = require("../async_result.js");
7
7
  /**
8
8
  * Transforms or recovers from errors. Has two forms:
9
9
  *
10
- * **Function form** transform all errors:
10
+ * **Function form** transforms all errors:
11
11
  * ```ts
12
12
  * R.mapErr(e => R.err("DEFAULT_ERROR", e.message))
13
13
  * ```
14
14
  *
15
- * **Handler object** handle specific error codes (with autocomplete):
15
+ * **Handler object** handles specific error codes (with autocomplete):
16
16
  * ```ts
17
17
  * R.mapErr({
18
18
  * NOT_FOUND: () => R.ok(guestUser), // recover with ok()
@@ -20,7 +20,7 @@ type UnwrapOperator = <R extends AnyResult>(result: R) => Match<[
20
20
  *
21
21
  * With `Promise<Result>` input, returns `Promise<T | undefined>`.
22
22
  *
23
- * Note: `unwrap` is a value (not a function call) use it without parentheses.
23
+ * Note: `unwrap` is a value, not a function call. Use it without parentheses.
24
24
  */
25
25
  export declare const unwrap: UnwrapOperator;
26
26
  export {};
@@ -13,7 +13,7 @@ const result_js_1 = require("../result.js");
13
13
  *
14
14
  * With `Promise<Result>` input, returns `Promise<T | undefined>`.
15
15
  *
16
- * Note: `unwrap` is a value (not a function call) use it without parentheses.
16
+ * Note: `unwrap` is a value, not a function call. Use it without parentheses.
17
17
  */
18
18
  const unwrap = (result) => {
19
19
  const handle = (r) => {
package/script/panic.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Thrown when an operator callback (`map`, `mapErr`, `match`) throws synchronously.
3
- * This signals a programmer error (a bug), not a domain error.
3
+ * This signals an unexpected throw, not a domain error.
4
4
  *
5
- * Extends `Error` catch with `instanceof R.Panic` if needed. The original
5
+ * Extends `Error`. Catch with `instanceof R.Panic` if needed. The original
6
6
  * error is available as `cause`. Promise rejections are different: they become
7
7
  * `UNKNOWN_ERR` results, not Panics.
8
8
  *
package/script/panic.js CHANGED
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Panic = void 0;
4
4
  /**
5
5
  * Thrown when an operator callback (`map`, `mapErr`, `match`) throws synchronously.
6
- * This signals a programmer error (a bug), not a domain error.
6
+ * This signals an unexpected throw, not a domain error.
7
7
  *
8
- * Extends `Error` catch with `instanceof R.Panic` if needed. The original
8
+ * Extends `Error`. Catch with `instanceof R.Panic` if needed. The original
9
9
  * error is available as `cause`. Promise rejections are different: they become
10
10
  * `UNKNOWN_ERR` results, not Panics.
11
11
  *
@@ -34,9 +34,9 @@ export type Err<C extends string> = {
34
34
  * transformations, error handling, and value extraction.
35
35
  */
36
36
  export interface ResultMethods<T, E extends string> {
37
- /** Type guard narrows to Ok with methods preserved. */
37
+ /** Type guard. Narrows to Ok with methods preserved. */
38
38
  isOk(): this is Ok<T> & ResultMethods<T, E>;
39
- /** Type guard narrows to Err with methods preserved. */
39
+ /** Type guard. Narrows to Err with methods preserved. */
40
40
  isErr(): this is Err<E> & ResultMethods<T, E>;
41
41
  /** Transform ok value; if fn returns Promise<Result>, becomes AsyncResult. */
42
42
  map<T2, E2 extends string>(fn: (value: T) => Promise<Result<T2, E2>>): AsyncResult<T2, E | E2 | "UNKNOWN_ERR">;
@@ -1 +1 @@
1
- {"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../src/result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK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