@consolidados/results 0.1.4 → 0.2.0

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 (44) hide show
  1. package/README.md +593 -253
  2. package/dist/helpers/match.cjs +28 -5
  3. package/dist/helpers/match.cjs.map +1 -1
  4. package/dist/helpers/match.d.cts +30 -3
  5. package/dist/helpers/match.d.ts +30 -3
  6. package/dist/helpers/match.js +28 -5
  7. package/dist/helpers/match.js.map +1 -1
  8. package/dist/index.cjs +312 -151
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.cts +2 -2
  11. package/dist/index.d.ts +2 -2
  12. package/dist/index.js +309 -150
  13. package/dist/index.js.map +1 -1
  14. package/dist/option/index.cjs +321 -18
  15. package/dist/option/index.cjs.map +1 -1
  16. package/dist/option/index.d.cts +1 -1
  17. package/dist/option/index.d.ts +1 -1
  18. package/dist/option/index.js +321 -18
  19. package/dist/option/index.js.map +1 -1
  20. package/dist/option/option.cjs +321 -18
  21. package/dist/option/option.cjs.map +1 -1
  22. package/dist/option/option.d.cts +5 -4
  23. package/dist/option/option.d.ts +5 -4
  24. package/dist/option/option.js +321 -18
  25. package/dist/option/option.js.map +1 -1
  26. package/dist/option-B_KKIecf.d.cts +352 -0
  27. package/dist/option-B_KKIecf.d.ts +352 -0
  28. package/dist/result/index.cjs +89 -23
  29. package/dist/result/index.cjs.map +1 -1
  30. package/dist/result/index.d.cts +1 -2
  31. package/dist/result/index.d.ts +1 -2
  32. package/dist/result/index.js +88 -23
  33. package/dist/result/index.js.map +1 -1
  34. package/dist/result/result.cjs +91 -23
  35. package/dist/result/result.cjs.map +1 -1
  36. package/dist/result/result.d.cts +4 -12
  37. package/dist/result/result.d.ts +4 -12
  38. package/dist/result/result.js +88 -23
  39. package/dist/result/result.js.map +1 -1
  40. package/dist/types/globals.d.cts +26 -146
  41. package/dist/types/globals.d.ts +26 -146
  42. package/package.json +72 -71
  43. package/dist/option-DpT8KCGE.d.cts +0 -96
  44. package/dist/option-DpT8KCGE.d.ts +0 -96
package/package.json CHANGED
@@ -1,73 +1,74 @@
1
1
  {
2
- "name": "@consolidados/results",
3
- "version": "0.1.4",
4
- "description": "Result types, ease and simple",
5
- "main": "./dist/index.js",
6
- "module": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
8
- "type": "module",
9
- "homepage": "https://github.com/consolidados/results",
10
- "repository": {
11
- "type": "git",
12
- "url": "https://github.com/consolidados/results"
13
- },
14
- "files": [
15
- "dist/"
16
- ],
17
- "exports": {
18
- "./option": {
19
- "types": "./dist/option/index.d.ts",
20
- "require": "./dist/option/index.cjs",
21
- "default": "./dist/option/index.js"
22
- },
23
- "./result": {
24
- "types": "./dist/result/index.d.ts",
25
- "require": "./dist/result/index.cjs",
26
- "default": "./dist/result/index.js"
27
- },
28
- "./helpers": {
29
- "types": "./dist/helpers/match.d.ts",
30
- "require": "./dist/helpers/match.cjs",
31
- "default": "./dist/helpers/match.js"
32
- },
33
- "./globals": {
34
- "types": "./dist/types/globals.d.ts"
35
- },
36
- ".": {
37
- "types": "./dist/index.d.ts",
38
- "require": "./dist/index.cjs",
39
- "default": "./dist/index.js"
40
- }
41
- },
42
- "scripts": {
43
- "build": "rm -rf dist && tsup",
44
- "test": "vitest run",
45
- "release": "release-it",
46
- "format-and-lint": "biome check .",
47
- "format-and-lint:fix": "biome check . --write"
48
- },
49
- "keywords": [
50
- "Rust",
51
- "Result",
52
- "Option",
53
- "Some",
54
- "None",
55
- "Ok",
56
- "Err",
57
- "Match"
58
- ],
59
- "author": "Johnny Carreiro",
60
- "license": "ISC",
61
- "devDependencies": {
62
- "@release-it/conventional-changelog": "^10.0.0",
63
- "@types/node": "^22.13.13",
64
- "biome": "^0.3.3",
65
- "release-it": "^18.1.2",
66
- "tsup": "^8.4.0",
67
- "typescript": "^5.8.2",
68
- "vitest": "^3.0.9"
69
- },
70
- "publishConfig": {
71
- "access": "public"
72
- }
2
+ "name": "@consolidados/results",
3
+ "version": "0.2.0",
4
+ "description": "Result types, ease and simple",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "type": "module",
9
+ "sideEffects": true,
10
+ "homepage": "https://github.com/consolidados/results",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/ConsoliDados/results.git"
14
+ },
15
+ "files": [
16
+ "dist/"
17
+ ],
18
+ "exports": {
19
+ "./option": {
20
+ "types": "./dist/option/index.d.ts",
21
+ "require": "./dist/option/index.cjs",
22
+ "default": "./dist/option/index.js"
23
+ },
24
+ "./result": {
25
+ "types": "./dist/result/index.d.ts",
26
+ "require": "./dist/result/index.cjs",
27
+ "default": "./dist/result/index.js"
28
+ },
29
+ "./helpers": {
30
+ "types": "./dist/helpers/match.d.ts",
31
+ "require": "./dist/helpers/match.cjs",
32
+ "default": "./dist/helpers/match.js"
33
+ },
34
+ "./globals": {
35
+ "types": "./dist/types/globals.d.ts"
36
+ },
37
+ ".": {
38
+ "types": "./dist/index.d.ts",
39
+ "require": "./dist/index.cjs",
40
+ "default": "./dist/index.js"
41
+ }
42
+ },
43
+ "scripts": {
44
+ "build": "rm -rf dist && tsup",
45
+ "test": "vitest run",
46
+ "format-and-lint": "biome check .",
47
+ "format-and-lint:fix": "biome check . --write"
48
+ },
49
+ "keywords": [
50
+ "Rust",
51
+ "Result",
52
+ "Option",
53
+ "Some",
54
+ "None",
55
+ "Ok",
56
+ "Err",
57
+ "Match"
58
+ ],
59
+ "author": "Johnny Carreiro",
60
+ "license": "ISC",
61
+ "devDependencies": {
62
+ "@release-it/conventional-changelog": "^10.0.0",
63
+ "@types/node": "^22.13.13",
64
+ "biome": "^0.3.3",
65
+ "release-it": "^18.1.2",
66
+ "tsup": "^8.4.0",
67
+ "typescript": "^5.9.3",
68
+ "vitest": "^3.0.9"
69
+ },
70
+ "publishConfig": {
71
+ "access": "public",
72
+ "provenance": true
73
+ }
73
74
  }
@@ -1,96 +0,0 @@
1
- /**
2
- * Represents a `Some` option, which holds a value.
3
- * @template T The type of the value held by this `Some` instance.
4
- */
5
- declare class Some<T> {
6
- private value;
7
- /**
8
- * Creates a new `Some` option with the given value.
9
- * @param value The value to be wrapped in the `Some` option.
10
- */
11
- constructor(value: T);
12
- /**
13
- * Checks if this option is a `Some`.
14
- * @returns `true` if this option is a `Some`, otherwise `false`.
15
- */
16
- isSome(): this is Some<T>;
17
- /**
18
- * Checks if this option is a `None`.
19
- * @returns `false` because this is a `Some`.
20
- */
21
- isNone(): this is None;
22
- /**
23
- * Unwraps the value held by this `Some` option.
24
- * @returns The value held by this `Some` option.
25
- */
26
- unwrap(): T;
27
- /**
28
- * Applies a transformation function to the value held by this `Some` option and returns a new `Option` with the transformed value.
29
- * @template U The type of the transformed value.
30
- * @param fn The transformation function to apply to the value.
31
- * @returns A new `Some` option containing the transformed value.
32
- */
33
- map<U>(fn: (value: T) => U): Option<U>;
34
- /**
35
- * Applies a transformation function that returns an `Option` to the value held by this `Some` option.
36
- * @template U The type of the value in the resulting `Option`.
37
- * @param fn The transformation function to apply to the value.
38
- * @returns The result of applying the transformation function.
39
- */
40
- flatMap<U>(fn: (value: T) => Option<U>): Option<U>;
41
- /**
42
- * Returns the value held by this `Some` option, ignoring the default value provided.
43
- * @param _ A default value (ignored in this implementation).
44
- * @returns The value held by this `Some` option.
45
- */
46
- unwrapOr(_: T): T;
47
- }
48
-
49
- /**
50
- * Represents a `None` option, which holds no value.
51
- */
52
- declare class None {
53
- /**
54
- * Checks if this option is a `Some`.
55
- * @returns `false` because this is a `None`.
56
- */
57
- isSome(): this is Some<never>;
58
- /**
59
- * Checks if this option is a `None`.
60
- * @returns `true` because this is a `None`.
61
- */
62
- isNone(): this is None;
63
- /**
64
- * Attempts to unwrap the value from this `None` option.
65
- * @throws An error because `None` has no value.
66
- */
67
- unwrap(): never;
68
- /**
69
- * Applies a transformation function to the value (which does not exist) of this `None` option.
70
- * @template U The type of the value that would have been returned.
71
- * @param _fn The transformation function (ignored in this implementation).
72
- * @returns A new `None` option.
73
- */
74
- map<U>(_fn: (value: never) => U): Option<U>;
75
- /**
76
- * Applies a transformation function that returns an `Option` to the value (which does not exist) of this `None` option.
77
- * @template U The type of the value in the resulting `Option`.
78
- * @param _fn The transformation function (ignored in this implementation).
79
- * @returns A new `None` option.
80
- */
81
- flatMap<U>(_fn: (value: never) => Option<U>): Option<U>;
82
- /**
83
- * Returns the default value provided, since `None` has no value.
84
- * @template T The type of the default value.
85
- * @param defaultValue The value to return.
86
- * @returns The default value provided.
87
- */
88
- unwrapOr<T>(defaultValue: T): T;
89
- }
90
-
91
- /**
92
- * Represents an optional value that can either be `Some` (with a value) or `None` (no value).
93
- */
94
- type Option<T> = Some<T> | None;
95
-
96
- export { None as N, type Option as O, Some as S };
@@ -1,96 +0,0 @@
1
- /**
2
- * Represents a `Some` option, which holds a value.
3
- * @template T The type of the value held by this `Some` instance.
4
- */
5
- declare class Some<T> {
6
- private value;
7
- /**
8
- * Creates a new `Some` option with the given value.
9
- * @param value The value to be wrapped in the `Some` option.
10
- */
11
- constructor(value: T);
12
- /**
13
- * Checks if this option is a `Some`.
14
- * @returns `true` if this option is a `Some`, otherwise `false`.
15
- */
16
- isSome(): this is Some<T>;
17
- /**
18
- * Checks if this option is a `None`.
19
- * @returns `false` because this is a `Some`.
20
- */
21
- isNone(): this is None;
22
- /**
23
- * Unwraps the value held by this `Some` option.
24
- * @returns The value held by this `Some` option.
25
- */
26
- unwrap(): T;
27
- /**
28
- * Applies a transformation function to the value held by this `Some` option and returns a new `Option` with the transformed value.
29
- * @template U The type of the transformed value.
30
- * @param fn The transformation function to apply to the value.
31
- * @returns A new `Some` option containing the transformed value.
32
- */
33
- map<U>(fn: (value: T) => U): Option<U>;
34
- /**
35
- * Applies a transformation function that returns an `Option` to the value held by this `Some` option.
36
- * @template U The type of the value in the resulting `Option`.
37
- * @param fn The transformation function to apply to the value.
38
- * @returns The result of applying the transformation function.
39
- */
40
- flatMap<U>(fn: (value: T) => Option<U>): Option<U>;
41
- /**
42
- * Returns the value held by this `Some` option, ignoring the default value provided.
43
- * @param _ A default value (ignored in this implementation).
44
- * @returns The value held by this `Some` option.
45
- */
46
- unwrapOr(_: T): T;
47
- }
48
-
49
- /**
50
- * Represents a `None` option, which holds no value.
51
- */
52
- declare class None {
53
- /**
54
- * Checks if this option is a `Some`.
55
- * @returns `false` because this is a `None`.
56
- */
57
- isSome(): this is Some<never>;
58
- /**
59
- * Checks if this option is a `None`.
60
- * @returns `true` because this is a `None`.
61
- */
62
- isNone(): this is None;
63
- /**
64
- * Attempts to unwrap the value from this `None` option.
65
- * @throws An error because `None` has no value.
66
- */
67
- unwrap(): never;
68
- /**
69
- * Applies a transformation function to the value (which does not exist) of this `None` option.
70
- * @template U The type of the value that would have been returned.
71
- * @param _fn The transformation function (ignored in this implementation).
72
- * @returns A new `None` option.
73
- */
74
- map<U>(_fn: (value: never) => U): Option<U>;
75
- /**
76
- * Applies a transformation function that returns an `Option` to the value (which does not exist) of this `None` option.
77
- * @template U The type of the value in the resulting `Option`.
78
- * @param _fn The transformation function (ignored in this implementation).
79
- * @returns A new `None` option.
80
- */
81
- flatMap<U>(_fn: (value: never) => Option<U>): Option<U>;
82
- /**
83
- * Returns the default value provided, since `None` has no value.
84
- * @template T The type of the default value.
85
- * @param defaultValue The value to return.
86
- * @returns The default value provided.
87
- */
88
- unwrapOr<T>(defaultValue: T): T;
89
- }
90
-
91
- /**
92
- * Represents an optional value that can either be `Some` (with a value) or `None` (no value).
93
- */
94
- type Option<T> = Some<T> | None;
95
-
96
- export { None as N, type Option as O, Some as S };