@mkvlrn/result 5.0.1 → 5.0.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.
Files changed (2) hide show
  1. package/README.md +12 -1
  2. package/package.json +8 -8
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Type-safe Result pattern for TypeScript representing success or error. Anything to avoid try/catch hell.
4
4
 
5
+ [![npm](https://img.shields.io/npm/v/@mkvlrn/result)](https://www.npmjs.com/package/@mkvlrn/result)
6
+
5
7
  ## Installation
6
8
 
7
9
  ```bash
@@ -28,6 +30,15 @@ if (result.isError) {
28
30
  }
29
31
  ```
30
32
 
33
+ ## API
34
+
35
+ | Export | Description |
36
+ | ------------------- | -------------------------------------------- |
37
+ | `Result<T, E>` | Union type representing success or failure |
38
+ | `AsyncResult<T, E>` | `Promise<Result<T, E>>` for async operations |
39
+ | `ok(value)` | Creates a success result |
40
+ | `err(error)` | Creates an error result |
41
+
31
42
  ## Examples
32
43
 
33
44
  ### Basic Function
@@ -41,7 +52,7 @@ function divide(a: number, b: number): Result<number, Error> {
41
52
  }
42
53
 
43
54
  const result = divide(10, 2);
44
- if (!result.isError) {
55
+ if (result.isOk) {
45
56
  console.log(result.value); // 5
46
57
  }
47
58
  ```
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": "5.0.1",
4
+ "version": "5.0.2",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "author": "Mike Valeriano <mkvlrn@proton.me>",
@@ -25,17 +25,17 @@
25
25
  "default": "./build/index.js"
26
26
  },
27
27
  "devDependencies": {
28
- "@types/node": "^24.10.0",
29
- "lint-staged": "^16.2.6",
30
- "rimraf": "^6.1.0",
28
+ "@types/node": "^25.0.3",
29
+ "lint-staged": "^16.2.7",
30
+ "rimraf": "^6.1.2",
31
31
  "tsc-files": "^1.1.4",
32
- "tsdown": "^0.16.1",
33
- "tsx": "^4.20.6",
32
+ "tsdown": "^0.18.2",
33
+ "tsx": "^4.21.0",
34
34
  "typescript": "^5.9.3",
35
- "vite-tsconfig-paths": "^5.1.4"
35
+ "vite-tsconfig-paths": "^6.0.3"
36
36
  },
37
37
  "dependencies": {
38
- "vitest": "^4.0.8"
38
+ "vitest": "^4.0.16"
39
39
  },
40
40
  "scripts": {
41
41
  "build": "tsdown",