@mkvlrn/result 4.0.13 → 4.0.15
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 +1 -1
- package/build/index.js +6 -7
- package/package.json +7 -10
- package/build/index.js.map +0 -1
package/README.md
CHANGED
package/build/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Result utility functions for creating Result objects.
|
|
3
|
+
*/
|
|
4
|
+
export const R = {
|
|
5
|
+
ok: (value) => ({ error: undefined, value }),
|
|
6
|
+
error: (error) => ({ error }),
|
|
4
7
|
};
|
|
5
|
-
export {
|
|
6
|
-
o as R
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mkvlrn/result",
|
|
3
3
|
"description": "Simple Result type/pattern for TypeScript",
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.15",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": "Mike Valeriano <mkvlrn@proton.me>",
|
|
@@ -25,26 +25,23 @@
|
|
|
25
25
|
"default": "./build/index.js"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
|
-
"build": "
|
|
29
|
-
"dev": "tsx --watch src/main.ts",
|
|
30
|
-
"start": "node build/bundle.js",
|
|
28
|
+
"build": "rimraf build && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json -f",
|
|
31
29
|
"test": "vitest",
|
|
32
30
|
"biome-check": "biome check --no-errors-on-unmatched",
|
|
33
|
-
"biome-fix": "
|
|
31
|
+
"biome-fix": "yarn biome-check --write",
|
|
34
32
|
"typecheck": "tsc --noEmit",
|
|
35
33
|
"lint-staged": "lint-staged",
|
|
36
34
|
"prepare": "husky"
|
|
37
35
|
},
|
|
38
36
|
"devDependencies": {
|
|
39
|
-
"@types/node": "^24.
|
|
37
|
+
"@types/node": "^24.3.0",
|
|
40
38
|
"@vitest/coverage-v8": "^3.2.4",
|
|
41
39
|
"lint-staged": "^16.1.5",
|
|
42
|
-
"
|
|
40
|
+
"rimraf": "^6.0.1",
|
|
41
|
+
"tsc-alias": "^1.8.16",
|
|
43
42
|
"tsc-files": "^1.1.4",
|
|
44
|
-
"tsx": "^4.20.
|
|
43
|
+
"tsx": "^4.20.5",
|
|
45
44
|
"typescript": "^5.9.2",
|
|
46
|
-
"vite": "^7.1.2",
|
|
47
|
-
"vite-plugin-dts": "^4.5.4",
|
|
48
45
|
"vite-tsconfig-paths": "^5.1.4",
|
|
49
46
|
"vitest": "^3.2.4"
|
|
50
47
|
}
|
package/build/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * Result type to represent the outcome of an operation.\n * It can either be a success with a value or an error.\n * This is a generic type that can be used with any type of value and error (should extend Error).\n *\n * It is also an alias object containing the ok and error functions to\n * make it easier to create Result objects.\n */\nexport type Result<T, E extends Error> =\n | { readonly error: undefined; readonly value: T }\n | { readonly error: E };\n\n/**\n * Async version of Result type that wraps a Result in a Promise.\n */\nexport type AsyncResult<T, E extends Error> = Promise<Result<T, E>>;\n\n/**\n * Result utility functions for creating Result objects.\n */\nexport const R: {\n /**\n * Creates a successful Result with the given value.\n * @param value The success value\n * @returns A Result object representing success\n */\n ok<T>(value: T): Result<T, never>;\n /**\n * Creates an error Result with the given error.\n * @param error The error value\n * @returns A Result object representing error\n */\n error<E extends Error>(error: E): Result<never, E>;\n} = {\n ok: <T>(value: T): Result<T, never> => ({ error: undefined, value }),\n error: <E extends Error>(error: E): Result<never, E> => ({ error }),\n};\n"],"names":["R","value","error"],"mappings":"AAoBO,MAAMA,IAaT;AAAA,EACF,IAAI,CAAIC,OAAgC,EAAE,OAAO,QAAW,OAAAA,EAAA;AAAA,EAC5D,OAAO,CAAkBC,OAAgC,EAAE,OAAAA,EAAA;AAC7D;"}
|