@indietabletop/appkit 7.0.0-rc.2 → 7.0.0-rc.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/lib/EnumMapper.ts CHANGED
@@ -8,9 +8,10 @@ export class EnumMapper<K extends string | number, V> {
8
8
  private fallback: V;
9
9
 
10
10
  constructor(values: InputValues<K, V>, fallback: V) {
11
- const entries = Array.isArray(values)
12
- ? values
13
- : (Object.entries(values) as Array<[K, V]>);
11
+ const entries =
12
+ Array.isArray(values) ? values : (
13
+ (Object.entries(values) as Array<[K, V]>)
14
+ );
14
15
  this.map = new Map(entries);
15
16
  this.fallback = fallback;
16
17
  }
@@ -44,6 +45,13 @@ export class EnumMapper<K extends string | number, V> {
44
45
  return Array.from(this.map.keys());
45
46
  }
46
47
 
48
+ /**
49
+ * Checks whether key is known by the mapper.
50
+ */
51
+ has(value: string | number): value is K {
52
+ return this.map.has(value as K);
53
+ }
54
+
47
55
  static from<K extends string>(values: InputValues<K, string>) {
48
56
  return new EnumMapper(values, "Unknown");
49
57
  }
package/lib/hrefs.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { omitUndefinedKeys } from "./omitUndefinedKeys.ts";
1
2
  import type { LinkUtmParams, createUtm } from "./utm.ts";
2
3
 
3
4
  export function withParams(path: string, params?: Record<string, string>) {
@@ -5,7 +6,12 @@ export function withParams(path: string, params?: Record<string, string>) {
5
6
  return path;
6
7
  }
7
8
 
8
- return `${path}?${new URLSearchParams(params)}`;
9
+ const cleanParams = omitUndefinedKeys(params);
10
+ if (Object.keys(cleanParams).length === 0) {
11
+ return path;
12
+ }
13
+
14
+ return `${path}?${new URLSearchParams(cleanParams)}`;
9
15
  }
10
16
 
11
17
  export type AccountParams = {
package/lib/index.ts CHANGED
@@ -56,6 +56,7 @@ export * from "./class-names.ts";
56
56
  export * from "./client.ts";
57
57
  export * from "./copyrightRange.ts";
58
58
  export * from "./createSafeStorage.ts";
59
+ export * from "./createStrictContext.ts";
59
60
  export * from "./failureMessages.ts";
60
61
  export * from "./fathom.ts";
61
62
  export * from "./groupBy.ts";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indietabletop/appkit",
3
- "version": "7.0.0-rc.2",
3
+ "version": "7.0.0-rc.4",
4
4
  "description": "A collection of modules used in apps built by Indie Tabletop Club",
5
5
  "private": false,
6
6
  "type": "module",