@mkvlrn/result 1.1.0 → 1.1.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/build/index.d.ts CHANGED
@@ -1,7 +1,3 @@
1
- /**
2
- * This module exports a Result type and helper functions that represent the outcome of an operation.
3
- * @module
4
- */
5
1
  /**
6
2
  * Result type to represent the outcome of an operation.
7
3
  * It can either be a success with a value or an error with an error message.
@@ -14,9 +10,6 @@ export type Result<T, E = Error> = {
14
10
  readonly ok: false;
15
11
  readonly error: E;
16
12
  };
17
- /**
18
- * Helper functions to create Result objects.
19
- */
20
13
  export declare const Result: {
21
14
  success<T>(value: T): Result<T, never>;
22
15
  error<E = Error>(error: E): Result<never, E>;
package/build/index.js CHANGED
@@ -1,27 +1,15 @@
1
- /**
2
- * This module exports a Result type and helper functions that represent the outcome of an operation.
3
- * @module
4
- */
5
- /**
6
- * Creates a successful Result with the given value.
7
- * @param value The success value
8
- * @returns A Result object representing success
9
- */
10
- function success(value) {
11
- return { ok: true, value: value };
12
- }
13
- /**
14
- * Creates a successful Result with the given value.
15
- * @param value The success value
16
- * @returns A Result object representing success
17
- */
18
- function error(error) {
19
- return { ok: false, error: error };
20
- }
21
- /**
22
- * Helper functions to create Result objects.
23
- */
1
+ // biome-ignore lint/nursery/useExplicitType: https://github.com/biomejs/biome/issues/5932
24
2
  export const Result = {
25
- success: success,
26
- error: error,
3
+ /**
4
+ * Creates a successful Result with the given value.
5
+ * @param value The success value
6
+ * @returns A Result object representing success
7
+ */
8
+ success: (value) => ({ ok: true, value: value }),
9
+ /**
10
+ * Creates a successful Result with the given value.
11
+ * @param value The success value
12
+ * @returns A Result object representing success
13
+ */
14
+ error: (error) => ({ ok: false, error: error }),
27
15
  };
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@mkvlrn/result",
3
- "version": "1.1.0",
3
+ "description": "Result type for TypeScript",
4
+ "version": "1.1.2",
4
5
  "license": "MIT",
5
6
  "type": "module",
6
7
  "publishConfig": {
@@ -18,7 +19,7 @@
18
19
  "build": "rm -rf build && tsc"
19
20
  },
20
21
  "devDependencies": {
21
- "@biomejs/biome": "^2.0.0-beta.1",
22
- "typescript": "^5.8.2"
22
+ "@biomejs/biome": "^2.0.0-beta.3",
23
+ "typescript": "^5.8.3"
23
24
  }
24
25
  }