@praha/byethrow 0.11.0 → 0.11.2
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/dist/cjs/exports.d.cts +26 -0
- package/dist/cjs/functions/{and-then.d.ts → and-then.d.cts} +1 -1
- package/dist/cjs/functions/{and-through.d.ts → and-through.d.cts} +1 -1
- package/dist/cjs/functions/{assert-failure.d.ts → assert-failure.d.cts} +2 -2
- package/dist/cjs/functions/{assert-success.d.ts → assert-success.d.cts} +2 -2
- package/dist/cjs/functions/{bind.d.ts → bind.d.cts} +1 -1
- package/dist/cjs/functions/{collect.d.ts → collect.d.cts} +1 -1
- package/dist/cjs/functions/{do.d.ts → do.d.cts} +1 -1
- package/dist/cjs/functions/fail.cjs +2 -1
- package/dist/cjs/functions/{fail.d.ts → fail.d.cts} +1 -1
- package/dist/cjs/functions/{fn.d.ts → fn.d.cts} +1 -1
- package/dist/cjs/functions/{inspect-error.d.ts → inspect-error.d.cts} +1 -1
- package/dist/cjs/functions/{inspect.d.ts → inspect.d.cts} +1 -1
- package/dist/cjs/functions/{is-failure.d.ts → is-failure.d.cts} +1 -1
- package/dist/cjs/functions/{is-result.d.ts → is-result.d.cts} +1 -1
- package/dist/cjs/functions/{is-success.d.ts → is-success.d.cts} +1 -1
- package/dist/cjs/functions/{map-error.d.ts → map-error.d.cts} +1 -1
- package/dist/cjs/functions/{map.d.ts → map.d.cts} +1 -1
- package/dist/cjs/functions/{or-else.d.ts → or-else.d.cts} +1 -1
- package/dist/cjs/functions/{or-through.d.ts → or-through.d.cts} +1 -1
- package/dist/cjs/functions/{parse.d.ts → parse.d.cts} +1 -1
- package/dist/cjs/functions/{sequence.d.ts → sequence.d.cts} +1 -1
- package/dist/cjs/functions/succeed.cjs +2 -1
- package/dist/cjs/functions/{succeed.d.ts → succeed.d.cts} +1 -1
- package/dist/cjs/functions/{try.d.ts → try.d.cts} +1 -1
- package/dist/cjs/functions/{unwrap-error.d.ts → unwrap-error.d.cts} +2 -2
- package/dist/cjs/functions/{unwrap.d.ts → unwrap.d.cts} +2 -2
- package/dist/cjs/{index.d.ts → index.d.cts} +2 -2
- package/dist/cjs/{result.d.ts → result.d.cts} +1 -1
- package/dist/esm/functions/fail.js +2 -1
- package/dist/esm/functions/succeed.js +2 -1
- package/package.json +7 -7
- package/dist/cjs/exports.d.ts +0 -26
- /package/dist/cjs/functions/{pipe.d.ts → pipe.d.cts} +0 -0
- /package/dist/cjs/internals/helpers/{is-promise.d.ts → is-promise.d.cts} +0 -0
- /package/dist/cjs/internals/types/{has-promise.d.ts → has-promise.d.cts} +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export * from './result.cjs';
|
|
2
|
+
export * from './functions/and-then.cjs';
|
|
3
|
+
export * from './functions/and-through.cjs';
|
|
4
|
+
export * from './functions/assert-failure.cjs';
|
|
5
|
+
export * from './functions/assert-success.cjs';
|
|
6
|
+
export * from './functions/bind.cjs';
|
|
7
|
+
export * from './functions/collect.cjs';
|
|
8
|
+
export * from './functions/do.cjs';
|
|
9
|
+
export * from './functions/fail.cjs';
|
|
10
|
+
export * from './functions/fn.cjs';
|
|
11
|
+
export * from './functions/inspect.cjs';
|
|
12
|
+
export * from './functions/inspect-error.cjs';
|
|
13
|
+
export * from './functions/is-failure.cjs';
|
|
14
|
+
export * from './functions/is-result.cjs';
|
|
15
|
+
export * from './functions/is-success.cjs';
|
|
16
|
+
export * from './functions/map.cjs';
|
|
17
|
+
export * from './functions/map-error.cjs';
|
|
18
|
+
export * from './functions/or-else.cjs';
|
|
19
|
+
export * from './functions/or-through.cjs';
|
|
20
|
+
export * from './functions/parse.cjs';
|
|
21
|
+
export * from './functions/pipe.cjs';
|
|
22
|
+
export * from './functions/sequence.cjs';
|
|
23
|
+
export * from './functions/succeed.cjs';
|
|
24
|
+
export * from './functions/try.cjs';
|
|
25
|
+
export * from './functions/unwrap.cjs';
|
|
26
|
+
export * from './functions/unwrap-error.cjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InferFailure, InferSuccess, ResultFor, ResultMaybeAsync } from '../result.
|
|
1
|
+
import type { InferFailure, InferSuccess, ResultFor, ResultMaybeAsync } from '../result.cjs';
|
|
2
2
|
/**
|
|
3
3
|
* Chains the next computation using the success value of a {@link Result} or {@link ResultAsync}.
|
|
4
4
|
* If the original result is a {@link Failure}, it is returned unchanged.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InferFailure, InferSuccess, ResultFor, ResultMaybeAsync } from '../result.
|
|
1
|
+
import type { InferFailure, InferSuccess, ResultFor, ResultMaybeAsync } from '../result.cjs';
|
|
2
2
|
/**
|
|
3
3
|
* Runs an additional computation using the success value of a {@link Result} or {@link ResultAsync},
|
|
4
4
|
* but **returns the original result** if the additional computation is successful.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { HasPromise } from '../internals/types/has-promise.
|
|
2
|
-
import type { Failure, InferFailure, ResultMaybeAsync } from '../result.
|
|
1
|
+
import type { HasPromise } from '../internals/types/has-promise.cjs';
|
|
2
|
+
import type { Failure, InferFailure, ResultMaybeAsync } from '../result.cjs';
|
|
3
3
|
/**
|
|
4
4
|
* Asserts that a {@link Result} or {@link ResultAsync} is a {@link Failure} and returns it.
|
|
5
5
|
* This function requires that the result's success type is `never`, meaning the result is
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { HasPromise } from '../internals/types/has-promise.
|
|
2
|
-
import type { InferSuccess, ResultMaybeAsync, Success } from '../result.
|
|
1
|
+
import type { HasPromise } from '../internals/types/has-promise.cjs';
|
|
2
|
+
import type { InferSuccess, ResultMaybeAsync, Success } from '../result.cjs';
|
|
3
3
|
/**
|
|
4
4
|
* Asserts that a {@link Result} or {@link ResultAsync} is a {@link Success} and returns it.
|
|
5
5
|
* This function requires that the result's error type is `never`, meaning the result is
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InferFailure, InferSuccess, ResultFor, ResultMaybeAsync } from '../result.
|
|
1
|
+
import type { InferFailure, InferSuccess, ResultFor, ResultMaybeAsync } from '../result.cjs';
|
|
2
2
|
/**
|
|
3
3
|
* Chains another {@link Result}-producing computation and **merges its success value**
|
|
4
4
|
* into the existing object under the specified key.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InferFailure, InferSuccess, ResultFor, ResultMaybeAsync } from '../result.
|
|
1
|
+
import type { InferFailure, InferSuccess, ResultFor, ResultMaybeAsync } from '../result.cjs';
|
|
2
2
|
/**
|
|
3
3
|
* Processes multiple {@link Result} or {@link ResultAsync} values into a single result.
|
|
4
4
|
* If all results are {@link Success}, returns a {@link Success} containing all values.
|
|
@@ -29,7 +29,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29
29
|
const is_promise_cjs_namespaceObject = require("../internals/helpers/is-promise.cjs");
|
|
30
30
|
const fail = (...args)=>{
|
|
31
31
|
if (args.length <= 0) return {
|
|
32
|
-
type: 'Failure'
|
|
32
|
+
type: 'Failure',
|
|
33
|
+
error: void 0
|
|
33
34
|
};
|
|
34
35
|
const error = args[0];
|
|
35
36
|
if ((0, is_promise_cjs_namespaceObject.isPromise)(error)) return error.then((error)=>({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InferFailure, InferSuccess, ResultFor, ResultMaybeAsync } from '../result.
|
|
1
|
+
import type { InferFailure, InferSuccess, ResultFor, ResultMaybeAsync } from '../result.cjs';
|
|
2
2
|
/**
|
|
3
3
|
* Executes a side effect function on the error value of a {@link Result} or {@link ResultAsync},
|
|
4
4
|
* without modifying the original result. This is useful for debugging, logging, or performing
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InferFailure, InferSuccess, ResultFor, ResultMaybeAsync } from '../result.
|
|
1
|
+
import type { InferFailure, InferSuccess, ResultFor, ResultMaybeAsync } from '../result.cjs';
|
|
2
2
|
/**
|
|
3
3
|
* Executes a side effect function on the success value of a {@link Result} or {@link ResultAsync},
|
|
4
4
|
* without modifying the original result. This is useful for debugging, logging, or performing
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InferFailure, InferSuccess, ResultFor, ResultMaybeAsync } from '../result.
|
|
1
|
+
import type { InferFailure, InferSuccess, ResultFor, ResultMaybeAsync } from '../result.cjs';
|
|
2
2
|
/**
|
|
3
3
|
* Applies a transformation function to the error value of a {@link Result} or {@link ResultAsync}.
|
|
4
4
|
* If the input is a {@link Success}, it will be returned unchanged.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InferFailure, InferSuccess, ResultFor, ResultMaybeAsync } from '../result.
|
|
1
|
+
import type { InferFailure, InferSuccess, ResultFor, ResultMaybeAsync } from '../result.cjs';
|
|
2
2
|
/**
|
|
3
3
|
* Applies a transformation function to the success value of a {@link Result} or {@link ResultAsync}.
|
|
4
4
|
* If the input is a {@link Failure}, it will be returned unchanged.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InferFailure, InferSuccess, ResultFor, ResultMaybeAsync } from '../result.
|
|
1
|
+
import type { InferFailure, InferSuccess, ResultFor, ResultMaybeAsync } from '../result.cjs';
|
|
2
2
|
/**
|
|
3
3
|
* Chains the next computation using the error value of a {@link Result} or {@link ResultAsync}.
|
|
4
4
|
* If the original result is a {@link Success}, it is returned unchanged.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InferFailure, InferSuccess, ResultFor, ResultMaybeAsync } from '../result.
|
|
1
|
+
import type { InferFailure, InferSuccess, ResultFor, ResultMaybeAsync } from '../result.cjs';
|
|
2
2
|
/**
|
|
3
3
|
* Runs an additional computation using the error value of a {@link Result} or {@link ResultAsync},
|
|
4
4
|
* but **returns the original failure** if the additional computation is successful.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Result } from '../result.
|
|
1
|
+
import type { Result } from '../result.cjs';
|
|
2
2
|
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
3
3
|
/**
|
|
4
4
|
* Parses a value using a {@link https://github.com/standard-schema/standard-schema Standard Schema} compatible schema.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InferFailure, InferSuccess, ResultFor, ResultMaybeAsync } from '../result.
|
|
1
|
+
import type { InferFailure, InferSuccess, ResultFor, ResultMaybeAsync } from '../result.cjs';
|
|
2
2
|
/**
|
|
3
3
|
* Processes multiple {@link Result} or {@link ResultAsync} values into a single result.
|
|
4
4
|
* If all results are {@link Success}, returns a {@link Success} containing all values.
|
|
@@ -29,7 +29,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29
29
|
const is_promise_cjs_namespaceObject = require("../internals/helpers/is-promise.cjs");
|
|
30
30
|
const succeed = (...args)=>{
|
|
31
31
|
if (args.length <= 0) return {
|
|
32
|
-
type: 'Success'
|
|
32
|
+
type: 'Success',
|
|
33
|
+
value: void 0
|
|
33
34
|
};
|
|
34
35
|
const value = args[0];
|
|
35
36
|
if ((0, is_promise_cjs_namespaceObject.isPromise)(value)) return value.then((value)=>({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { HasPromise } from '../internals/types/has-promise.
|
|
2
|
-
import type { InferFailure, ResultMaybeAsync } from '../result.
|
|
1
|
+
import type { HasPromise } from '../internals/types/has-promise.cjs';
|
|
2
|
+
import type { InferFailure, ResultMaybeAsync } from '../result.cjs';
|
|
3
3
|
/**
|
|
4
4
|
* Extracts the error value from a {@link Result} or {@link ResultAsync}.
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { HasPromise } from '../internals/types/has-promise.
|
|
2
|
-
import type { InferSuccess, ResultMaybeAsync } from '../result.
|
|
1
|
+
import type { HasPromise } from '../internals/types/has-promise.cjs';
|
|
2
|
+
import type { InferSuccess, ResultMaybeAsync } from '../result.cjs';
|
|
3
3
|
/**
|
|
4
4
|
* Extracts the success value from a {@link Result} or {@link ResultAsync}.
|
|
5
5
|
*
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { isPromise } from "../internals/helpers/is-promise.js";
|
|
2
2
|
const succeed = (...args)=>{
|
|
3
3
|
if (args.length <= 0) return {
|
|
4
|
-
type: 'Success'
|
|
4
|
+
type: 'Success',
|
|
5
|
+
value: void 0
|
|
5
6
|
};
|
|
6
7
|
const value = args[0];
|
|
7
8
|
if (isPromise(value)) return value.then((value)=>({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@praha/byethrow",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.2",
|
|
4
4
|
"description": "A lightweight, tree-shakable Result type package with a simple, consistent API designed",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"type": "module",
|
|
25
25
|
"exports": {
|
|
26
26
|
"require": {
|
|
27
|
-
"types": "./dist/cjs/index.d.
|
|
27
|
+
"types": "./dist/cjs/index.d.cts",
|
|
28
28
|
"default": "./dist/cjs/index.cjs"
|
|
29
29
|
},
|
|
30
30
|
"import": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"main": "./dist/cjs/index.cjs",
|
|
36
36
|
"module": "./dist/esm/index.js",
|
|
37
|
-
"types": "./dist/cjs/index.d.
|
|
37
|
+
"types": "./dist/cjs/index.d.cts",
|
|
38
38
|
"files": [
|
|
39
39
|
"dist",
|
|
40
40
|
"LICENSE",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"@standard-schema/spec": "^1.0.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@rslib/core": "0.21.
|
|
48
|
-
"oxlint": "1.
|
|
49
|
-
"typedoc": "0.28.
|
|
47
|
+
"@rslib/core": "0.21.4",
|
|
48
|
+
"oxlint": "1.62.0",
|
|
49
|
+
"typedoc": "0.28.19",
|
|
50
50
|
"typedoc-plugin-markdown": "4.11.0",
|
|
51
51
|
"typescript": "5.9.3",
|
|
52
|
-
"vitest": "4.1.
|
|
52
|
+
"vitest": "4.1.5"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"typescript": ">=5.0.0"
|
package/dist/cjs/exports.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export * from './result.js';
|
|
2
|
-
export * from './functions/and-then.js';
|
|
3
|
-
export * from './functions/and-through.js';
|
|
4
|
-
export * from './functions/assert-failure.js';
|
|
5
|
-
export * from './functions/assert-success.js';
|
|
6
|
-
export * from './functions/bind.js';
|
|
7
|
-
export * from './functions/collect.js';
|
|
8
|
-
export * from './functions/do.js';
|
|
9
|
-
export * from './functions/fail.js';
|
|
10
|
-
export * from './functions/fn.js';
|
|
11
|
-
export * from './functions/inspect.js';
|
|
12
|
-
export * from './functions/inspect-error.js';
|
|
13
|
-
export * from './functions/is-failure.js';
|
|
14
|
-
export * from './functions/is-result.js';
|
|
15
|
-
export * from './functions/is-success.js';
|
|
16
|
-
export * from './functions/map.js';
|
|
17
|
-
export * from './functions/map-error.js';
|
|
18
|
-
export * from './functions/or-else.js';
|
|
19
|
-
export * from './functions/or-through.js';
|
|
20
|
-
export * from './functions/parse.js';
|
|
21
|
-
export * from './functions/pipe.js';
|
|
22
|
-
export * from './functions/sequence.js';
|
|
23
|
-
export * from './functions/succeed.js';
|
|
24
|
-
export * from './functions/try.js';
|
|
25
|
-
export * from './functions/unwrap.js';
|
|
26
|
-
export * from './functions/unwrap-error.js';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|