result_option 0.1.2 → 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 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,13 +1,16 @@
1
1
  {
2
2
  "name": "result_option",
3
- "version": "0.1.2",
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",
7
7
  "types": "./dist/index.d.ts",
8
+ "repository": "https://github.com/Cunha-Renato/result_option",
8
9
  "files": [
9
10
  "dist",
10
- "README.md"
11
+ "README.md",
12
+ "LICENSE.APACHE",
13
+ "LICENSE.MIT"
11
14
  ],
12
15
  "keywords": [
13
16
  "Result",
@@ -15,7 +18,7 @@
15
18
  "Type"
16
19
  ],
17
20
  "author": "Renato Cunha",
18
- "license": "ISC",
21
+ "license": "MIT or Apache-2.0",
19
22
  "dependencies": {
20
23
  "typescript": "^6.0.2"
21
24
  },
@@ -24,6 +27,7 @@
24
27
  },
25
28
  "scripts": {
26
29
  "build": "tsc",
27
- "test": "vitest"
30
+ "test": "vitest",
31
+ "pub": "pnpm run build && pnpm publish"
28
32
  }
29
33
  }