@praha/byethrow 0.6.2 → 0.6.3

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
@@ -1,4 +1,4 @@
1
- # @praha/byethrow
1
+ # @praha/byethrow 👋
2
2
 
3
3
  [![npm version](https://badge.fury.io/js/@praha%2Fbyethrow.svg)](https://www.npmjs.com/package/@praha/byethrow)
4
4
  [![npm download](https://img.shields.io/npm/dm/@praha/byethrow.svg)](https://www.npmjs.com/package/@praha/byethrow)
@@ -29,8 +29,8 @@ npm install @praha/byethrow
29
29
 
30
30
  ## 📚 Documentation
31
31
 
32
- Detailed API docs are available at:
33
- 👉 https://praha-inc.github.io/byethrow
32
+ - Website: For detailed information and usage examples, visit the [byethrow website](https://praha-inc.github.io/byethrow).
33
+ - API Reference: For a complete API reference of the core package effect, see the [byethrow API Reference](https://praha-inc.github.io/byethrow/api).
34
34
 
35
35
  ## 🚀 Quick Example
36
36
 
@@ -28,10 +28,10 @@ __webpack_require__.d(__webpack_exports__, {
28
28
  });
29
29
  const is_promise_cjs_namespaceObject = require("../internals/helpers/is-promise.cjs");
30
30
  const fail = (...args)=>{
31
- const error = args[0];
32
- if (void 0 === error) return {
31
+ if (args.length <= 0) return {
33
32
  type: 'Failure'
34
33
  };
34
+ const error = args[0];
35
35
  if ((0, is_promise_cjs_namespaceObject.isPromise)(error)) return error.then((error)=>({
36
36
  type: 'Failure',
37
37
  error: error
@@ -28,10 +28,10 @@ __webpack_require__.d(__webpack_exports__, {
28
28
  });
29
29
  const is_promise_cjs_namespaceObject = require("../internals/helpers/is-promise.cjs");
30
30
  const succeed = (...args)=>{
31
- const value = args[0];
32
- if (void 0 === value) return {
31
+ if (args.length <= 0) return {
33
32
  type: 'Success'
34
33
  };
34
+ const value = args[0];
35
35
  if ((0, is_promise_cjs_namespaceObject.isPromise)(value)) return value.then((value)=>({
36
36
  type: 'Success',
37
37
  value: value
@@ -158,11 +158,7 @@ export type ResultFor<R, T, E> = true extends HasPromise<R> ? ResultAsync<T, E>
158
158
  *
159
159
  * @category Infer Types
160
160
  */
161
- export type InferSuccess<T> = [
162
- T
163
- ] extends [(...args: any[]) => ResultMaybeAsync<infer U, any>] ? U : [
164
- T
165
- ] extends [ResultMaybeAsync<infer U, any>] ? U : never;
161
+ export type InferSuccess<T> = [T] extends [(...args: any[]) => ResultMaybeAsync<infer U, any>] ? U : [T] extends [ResultMaybeAsync<infer U, any>] ? U : never;
166
162
  /**
167
163
  * Infers the {@link Failure} value type `E` from a Result or a function returning a Result.
168
164
  *
@@ -186,8 +182,4 @@ export type InferSuccess<T> = [
186
182
  *
187
183
  * @category Infer Types
188
184
  */
189
- export type InferFailure<T> = [
190
- T
191
- ] extends [(...args: any[]) => ResultMaybeAsync<any, infer U>] ? U : [
192
- T
193
- ] extends [ResultMaybeAsync<any, infer U>] ? U : never;
185
+ export type InferFailure<T> = [T] extends [(...args: any[]) => ResultMaybeAsync<any, infer U>] ? U : [T] extends [ResultMaybeAsync<any, infer U>] ? U : never;
@@ -1,9 +1,9 @@
1
1
  import { isPromise } from "../internals/helpers/is-promise.js";
2
2
  const fail = (...args)=>{
3
- const error = args[0];
4
- if (void 0 === error) return {
3
+ if (args.length <= 0) return {
5
4
  type: 'Failure'
6
5
  };
6
+ const error = args[0];
7
7
  if (isPromise(error)) return error.then((error)=>({
8
8
  type: 'Failure',
9
9
  error: error
@@ -1,9 +1,9 @@
1
1
  import { isPromise } from "../internals/helpers/is-promise.js";
2
2
  const succeed = (...args)=>{
3
- const value = args[0];
4
- if (void 0 === value) return {
3
+ if (args.length <= 0) return {
5
4
  type: 'Success'
6
5
  };
6
+ const value = args[0];
7
7
  if (isPromise(value)) return value.then((value)=>({
8
8
  type: 'Success',
9
9
  value: value
@@ -158,11 +158,7 @@ export type ResultFor<R, T, E> = true extends HasPromise<R> ? ResultAsync<T, E>
158
158
  *
159
159
  * @category Infer Types
160
160
  */
161
- export type InferSuccess<T> = [
162
- T
163
- ] extends [(...args: any[]) => ResultMaybeAsync<infer U, any>] ? U : [
164
- T
165
- ] extends [ResultMaybeAsync<infer U, any>] ? U : never;
161
+ export type InferSuccess<T> = [T] extends [(...args: any[]) => ResultMaybeAsync<infer U, any>] ? U : [T] extends [ResultMaybeAsync<infer U, any>] ? U : never;
166
162
  /**
167
163
  * Infers the {@link Failure} value type `E` from a Result or a function returning a Result.
168
164
  *
@@ -186,8 +182,4 @@ export type InferSuccess<T> = [
186
182
  *
187
183
  * @category Infer Types
188
184
  */
189
- export type InferFailure<T> = [
190
- T
191
- ] extends [(...args: any[]) => ResultMaybeAsync<any, infer U>] ? U : [
192
- T
193
- ] extends [ResultMaybeAsync<any, infer U>] ? U : never;
185
+ export type InferFailure<T> = [T] extends [(...args: any[]) => ResultMaybeAsync<any, infer U>] ? U : [T] extends [ResultMaybeAsync<any, infer U>] ? U : never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@praha/byethrow",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "A lightweight, tree-shakable Result type package with a simple, consistent API designed",
5
5
  "keywords": [
6
6
  "javascript",
@@ -44,9 +44,10 @@
44
44
  "@standard-schema/spec": "^1.0.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@rslib/core": "0.10.5",
48
- "eslint": "9.30.1",
49
- "typedoc": "0.28.7",
47
+ "@rslib/core": "0.11.2",
48
+ "eslint": "9.32.0",
49
+ "typedoc": "0.28.10",
50
+ "typedoc-plugin-markdown": "4.8.0",
50
51
  "typescript": "5.8.3",
51
52
  "vitest": "3.2.4"
52
53
  },