@mkvlrn/result 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.
- package/build/index.d.ts +0 -4
- package/build/index.js +16 -22
- package/package.json +4 -3
package/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
|
@@ -1,27 +1,21 @@
|
|
|
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
1
|
/**
|
|
22
2
|
* Helper functions to create Result objects.
|
|
23
3
|
*/
|
|
24
4
|
export const Result = {
|
|
25
|
-
|
|
26
|
-
|
|
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
|
+
success: function (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
|
+
error: function (error) {
|
|
19
|
+
return { ok: false, error: error };
|
|
20
|
+
},
|
|
27
21
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mkvlrn/result",
|
|
3
|
-
"
|
|
3
|
+
"description": "Result type for TypeScript",
|
|
4
|
+
"version": "1.1.1",
|
|
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.
|
|
22
|
-
"typescript": "^5.8.
|
|
22
|
+
"@biomejs/biome": "^2.0.0-beta.3",
|
|
23
|
+
"typescript": "^5.8.3"
|
|
23
24
|
}
|
|
24
25
|
}
|