@terrygonguet/utils 0.9.0 → 0.10.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.
package/dist/option.d.ts CHANGED
@@ -3,6 +3,7 @@ declare class Option<T> {
3
3
  readonly _kind: "Some" | "None";
4
4
  readonly value: T;
5
5
  private constructor();
6
+ [Symbol.iterator](): Iterator<Option<T>, T>;
6
7
  static do<T>(f: () => Iterator<Option<any>, T, any>): Option<T>;
7
8
  static from<T>(maybeValue: unknown, { allowOptionLikePOJO }?: {
8
9
  allowOptionLikePOJO?: boolean | undefined;
@@ -13,7 +14,6 @@ declare class Option<T> {
13
14
  static isOption<T>(maybeOption: unknown): maybeOption is Option<T>;
14
15
  static Some<T>(value: T): Option<T>;
15
16
  static None<T>(): Option<T>;
16
- [Symbol.iterator](): Iterator<Option<T>, T>;
17
17
  [Symbol.toPrimitive](): string;
18
18
  isSome(): boolean;
19
19
  isNone(): boolean;
package/dist/option.js CHANGED
@@ -6,6 +6,12 @@ var Option = class _Option {
6
6
  this._kind = _kind;
7
7
  this.value = value;
8
8
  }
9
+ *[Symbol.iterator]() {
10
+ yield this;
11
+ if (this.isNone())
12
+ throw new Error("Tried to unwrap a None() via its iterator");
13
+ else return this.value;
14
+ }
9
15
  static do(f) {
10
16
  const gen = f();
11
17
  let iter = gen.next();
@@ -45,12 +51,6 @@ var Option = class _Option {
45
51
  static None() {
46
52
  return this.#None;
47
53
  }
48
- *[Symbol.iterator]() {
49
- yield this;
50
- if (this.isNone())
51
- throw new Error("Tried to unwrap a None() via its iterator");
52
- else return this.value;
53
- }
54
54
  [Symbol.toPrimitive]() {
55
55
  return this.toString();
56
56
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@terrygonguet/utils",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "scripts": {
7
- "dev": "vite",
7
+ "dev": "vitest --watch --typecheck --update",
8
8
  "build": "tsup",
9
9
  "test": "vitest test --typecheck"
10
10
  },
@@ -47,8 +47,8 @@
47
47
  "prettier": "^3.6.2",
48
48
  "tsup": "^8.5.0",
49
49
  "typescript": "^5.9.3",
50
- "vite": "^6.3.6",
51
- "vitest": "^3.2.4"
50
+ "vite": "^7.1.12",
51
+ "vitest": "^4.0.2"
52
52
  },
53
53
  "author": {
54
54
  "email": "terry@gonguet.com",
@@ -57,7 +57,7 @@
57
57
  },
58
58
  "repository": {
59
59
  "type": "git",
60
- "url": "https://github.com/terrygonguet/utils.git"
60
+ "url": "git+https://github.com/terrygonguet/utils.git"
61
61
  },
62
62
  "bugs": {
63
63
  "url": "https://github.com/terrygonguet/utils/issues"