@thi.ng/api 8.10.1 → 8.11.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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-04-11T12:32:44Z
3
+ - **Last updated**: 2024-04-20T14:42:45Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
9
9
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
10
10
  and/or version bumps of transitive dependencies.
11
11
 
12
+ ## [8.11.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/api@8.11.0) (2024-04-20)
13
+
14
+ #### 🚀 Features
15
+
16
+ - add Maybe type alias, refactor related ([0777d33](https://github.com/thi-ng/umbrella/commit/0777d33))
17
+
12
18
  ## [8.10.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/api@8.10.0) (2024-04-08)
13
19
 
14
20
  #### 🚀 Features
package/README.md CHANGED
@@ -55,10 +55,10 @@ import * as api from "@thi.ng/api";
55
55
  Browser ESM import:
56
56
 
57
57
  ```html
58
- <script type="module" src="https://cdn.skypack.dev/@thi.ng/api"></script>
58
+ <script type="module" src="https://esm.run/@thi.ng/api"></script>
59
59
  ```
60
60
 
61
- [Skypack documentation](https://docs.skypack.dev/)
61
+ [JSDelivr documentation](https://www.jsdelivr.com/)
62
62
 
63
63
  For Node.js REPL:
64
64
 
package/get.d.ts CHANGED
@@ -1,15 +1,16 @@
1
+ import type { Maybe } from "./null.js";
1
2
  /**
2
3
  * @param K - key type
3
4
  * @param V - value type
4
5
  */
5
6
  export interface IGet<K, V> {
6
- get(key: K, notfound?: V): V | undefined;
7
+ get(key: K, notfound?: V): Maybe<V>;
7
8
  }
8
9
  /**
9
10
  * @param K - key type
10
11
  * @param V - value type
11
12
  */
12
13
  export interface IGetIn<K, V> {
13
- getIn(key: K[], notfound?: V): V | undefined;
14
+ getIn(key: K[], notfound?: V): Maybe<V>;
14
15
  }
15
16
  //# sourceMappingURL=get.d.ts.map
package/null.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export type Maybe<T> = T | undefined;
1
2
  export type Nullable<T> = T | null | undefined;
2
3
  /**
3
4
  * Similar to `NonNullable`, but only excludes `undefined`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/api",
3
- "version": "8.10.1",
3
+ "version": "8.11.0",
4
4
  "description": "Common, generic types, interfaces & mixins",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -229,5 +229,5 @@
229
229
  "default": "./watch.js"
230
230
  }
231
231
  },
232
- "gitHead": "18a0c063a7b33d790e5bc2486c106f45f663ac28\n"
232
+ "gitHead": "8339d05ecc857e529c7325a9839c0063b89e728d\n"
233
233
  }
package/path.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import type { NumOrString } from "./prim.js";
2
1
  import type { Keys, Keys1, Keys2, Keys3, Keys4, Keys5, Keys6, Keys7, ValN } from "./keyval.js";
3
- import type { Head, Tail, IsEmpty } from "./tuple.js";
2
+ import type { Maybe } from "./null.js";
3
+ import type { NumOrString } from "./prim.js";
4
+ import type { Head, IsEmpty, Tail } from "./tuple.js";
4
5
  /**
5
6
  * Unchecked lookup path for nested data structures.
6
7
  */
@@ -47,9 +48,9 @@ export type Path8<T, A, B, C, D, E, F, G, H> = A extends Keys<T> ? B extends Key
47
48
  */
48
49
  export type DeepPath<T, A, B, C, D, E, F, G, H> = A extends Keys<T> ? B extends Keys1<T, A> ? C extends Keys2<T, A, B> ? D extends Keys3<T, A, B, C> ? E extends Keys4<T, A, B, C, D> ? F extends Keys5<T, A, B, C, D, E> ? G extends Keys6<T, A, B, C, D, E, F> ? H extends Keys7<T, A, B, C, D, E, F, G> ? readonly [A, B, C, D, E, F, G, H, ...NumOrString[]] : never : never : never : never : never : never : never : never;
49
50
  /**
50
- * Returns `RES` if `PRED` is `never`, else `RES | undefined`
51
+ * Returns `RES` if `PRED` is `never`, else `Maybe<RES>`
51
52
  */
52
- export type OptVal<PRED, RES> = [PRED] extends [never] ? RES : RES | undefined;
53
+ export type OptVal<PRED, RES> = [PRED] extends [never] ? RES : Maybe<RES>;
53
54
  /**
54
55
  * Returns true if `T` includes undefined.
55
56
  */
package/seq.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { Maybe } from "./null.js";
1
2
  /**
2
3
  * Lisp-like sequence abstraction for arbitrary types using `first` &
3
4
  * `next` operations only.
@@ -18,7 +19,7 @@ export interface ISeq<T> {
18
19
  * determine the end. If the sequence DOES contain `undefined`
19
20
  * values, the check should use `seq.next()`.
20
21
  */
21
- first(): T | undefined;
22
+ first(): Maybe<T>;
22
23
  /**
23
24
  * Returns a new sequence of the remaining elements or `undefined`
24
25
  * if there're no further values.
@@ -28,7 +29,7 @@ export interface ISeq<T> {
28
29
  * a new sequence instance and not mutate some internal cursor. I.e.
29
30
  * `seq.next() !== seq`
30
31
  */
31
- next(): ISeq<T> | undefined;
32
+ next(): Maybe<ISeq<T>>;
32
33
  }
33
34
  /**
34
35
  * Interface for data types providing an {@link ISeq} abstraction.
@@ -38,6 +39,6 @@ export interface ISeqable<T> {
38
39
  * Returns an {@link ISeq} of the type's data or `undefined` if
39
40
  * there're no values available. See {@link ISeq.next}
40
41
  */
41
- seq(): ISeq<T> | undefined;
42
+ seq(): Maybe<ISeq<T>>;
42
43
  }
43
44
  //# sourceMappingURL=seq.d.ts.map
package/stack.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { Maybe } from "./null.js";
1
2
  /**
2
3
  * Generic interface for collections implementing
3
4
  * stack functionality.
@@ -10,11 +11,16 @@ export interface IStack<V, P, S> {
10
11
  /**
11
12
  * Returns top-of-stack item.
12
13
  */
13
- peek(): V | undefined;
14
+ peek(): Maybe<V>;
14
15
  /**
15
16
  * Removes top-of-stack item and returns type P.
16
17
  */
17
- pop(): P | undefined;
18
+ pop(): Maybe<P>;
19
+ /**
20
+ * Pushes item onto stack, returns type S.
21
+ *
22
+ * @param x
23
+ */
18
24
  push(x: V): S;
19
25
  }
20
26
  //# sourceMappingURL=stack.d.ts.map
package/typedarray.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { Maybe } from "./null.js";
1
2
  export type ArrayLikeIterable<T> = ArrayLike<T> & Iterable<T>;
2
3
  export type NumericArray = number[] | TypedArray;
3
4
  export type TypedArray = Float32Array | Float64Array | Int8Array | Int16Array | Int32Array | Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array;
@@ -49,7 +50,7 @@ export declare const GL2TYPE: Record<GLType, Type>;
49
50
  * - `F64` maps to `undefined`, since unsupported by WebGL
50
51
  * - `U8C` maps to "u8"
51
52
  */
52
- export declare const TYPE2GL: Record<Type, GLType | undefined>;
53
+ export declare const TYPE2GL: Record<Type, Maybe<GLType>>;
53
54
  /**
54
55
  * Size information (in bytes) for {@link Type} and {@link BigType}. Also see
55
56
  * {@link sizeOf}.