result_option 0.1.3 → 0.1.4
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/dist/index.d.ts +6 -0
- package/dist/index.js +8 -0
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
export declare class Option<T> {
|
|
5
5
|
#private;
|
|
6
6
|
private constructor();
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param value
|
|
10
|
+
* @returns `Option<T>` where `Some(value)` if `value` !== null and `None` if `value` === null.
|
|
11
|
+
*/
|
|
12
|
+
static From<T>(value: T | null): Option<T>;
|
|
7
13
|
/**
|
|
8
14
|
*
|
|
9
15
|
* @param value - The value to be `Some`.
|
package/dist/index.js
CHANGED
|
@@ -18,6 +18,14 @@ export class Option {
|
|
|
18
18
|
_Option_val.set(this, void 0);
|
|
19
19
|
__classPrivateFieldSet(this, _Option_val, value, "f");
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param value
|
|
24
|
+
* @returns `Option<T>` where `Some(value)` if `value` !== null and `None` if `value` === null.
|
|
25
|
+
*/
|
|
26
|
+
static From(value) {
|
|
27
|
+
return value === null ? Option.None() : Option.Some(value);
|
|
28
|
+
}
|
|
21
29
|
/**
|
|
22
30
|
*
|
|
23
31
|
* @param value - The value to be `Some`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "result_option",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Result and Option types for typescript.",
|
|
5
5
|
"main": "./dist/index.ts",
|
|
6
6
|
"module": "./dist/index.mts",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
29
|
"build": "tsc",
|
|
30
|
-
"test": "vitest"
|
|
30
|
+
"test": "vitest",
|
|
31
|
+
"pub": "pnpm run build && pnpm publish"
|
|
31
32
|
}
|
|
32
33
|
}
|