shelving 1.91.0 → 1.91.2

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.
Files changed (130) hide show
  1. package/api/Resource.d.ts +1 -1
  2. package/api/Resource.js +6 -4
  3. package/constraint/Constraints.d.ts +1 -1
  4. package/constraint/Constraints.js +1 -1
  5. package/constraint/Filter.d.ts +4 -4
  6. package/constraint/Filter.js +5 -3
  7. package/constraint/Filters.d.ts +3 -2
  8. package/constraint/Filters.js +3 -3
  9. package/constraint/Sort.d.ts +3 -3
  10. package/constraint/Sort.js +3 -1
  11. package/constraint/Sorts.d.ts +4 -3
  12. package/constraint/Statement.d.ts +4 -2
  13. package/constraint/Statement.js +4 -4
  14. package/db/Change.d.ts +4 -4
  15. package/db/Collection.d.ts +5 -4
  16. package/db/Database.d.ts +7 -7
  17. package/db/Database.js +3 -3
  18. package/db/Item.d.ts +5 -5
  19. package/db/Item.js +1 -1
  20. package/db/ItemState.d.ts +3 -3
  21. package/db/ItemState.js +4 -4
  22. package/db/Query.d.ts +5 -5
  23. package/db/Query.js +2 -2
  24. package/db/QueryState.d.ts +3 -3
  25. package/db/QueryState.js +4 -4
  26. package/feedback/Feedback.d.ts +0 -4
  27. package/feedback/Feedback.js +0 -4
  28. package/feedback/Feedbacks.d.ts +2 -4
  29. package/feedback/Feedbacks.js +6 -5
  30. package/firestore/client/FirestoreClientProvider.d.ts +4 -4
  31. package/firestore/client/FirestoreClientProvider.js +7 -2
  32. package/firestore/lite/FirestoreLiteProvider.d.ts +4 -4
  33. package/firestore/lite/FirestoreLiteProvider.js +7 -2
  34. package/firestore/server/FirestoreServerProvider.d.ts +4 -4
  35. package/firestore/server/FirestoreServerProvider.js +7 -2
  36. package/markup/regexp.d.ts +2 -2
  37. package/markup/render.d.ts +1 -1
  38. package/markup/rule.d.ts +5 -5
  39. package/markup/rules.d.ts +3 -2
  40. package/markup/rules.js +1 -1
  41. package/package.json +3 -4
  42. package/provider/CacheProvider.d.ts +3 -3
  43. package/provider/DebugProvider.d.ts +3 -3
  44. package/provider/MemoryProvider.d.ts +3 -3
  45. package/provider/MemoryProvider.js +3 -3
  46. package/provider/Provider.d.ts +1 -1
  47. package/provider/ThroughProvider.d.ts +3 -3
  48. package/provider/ValidationProvider.d.ts +5 -5
  49. package/provider/ValidationProvider.js +4 -4
  50. package/react/createCache.js +1 -1
  51. package/react/useData.d.ts +1 -1
  52. package/react/useData.js +3 -3
  53. package/react/useLazy.d.ts +1 -1
  54. package/react/useState.d.ts +1 -1
  55. package/schema/AllowSchema.d.ts +3 -2
  56. package/schema/AllowSchema.js +2 -2
  57. package/schema/ArraySchema.d.ts +4 -3
  58. package/schema/ArraySchema.js +1 -1
  59. package/schema/BooleanSchema.d.ts +2 -1
  60. package/schema/DataSchema.d.ts +4 -3
  61. package/schema/DataSchema.js +1 -1
  62. package/schema/DateSchema.d.ts +3 -2
  63. package/schema/DateSchema.js +2 -2
  64. package/schema/DictionarySchema.d.ts +4 -3
  65. package/schema/DictionarySchema.js +1 -1
  66. package/schema/KeySchema.js +1 -1
  67. package/schema/LinkSchema.d.ts +2 -1
  68. package/schema/NumberSchema.d.ts +2 -1
  69. package/schema/NumberSchema.js +2 -2
  70. package/schema/OptionalSchema.d.ts +1 -1
  71. package/schema/PhoneSchema.js +1 -1
  72. package/schema/RequiredSchema.d.ts +1 -1
  73. package/schema/StringSchema.d.ts +2 -1
  74. package/schema/StringSchema.js +1 -1
  75. package/schema/ThroughSchema.d.ts +2 -1
  76. package/schema/TimeSchema.d.ts +4 -2
  77. package/schema/TimeSchema.js +1 -1
  78. package/state/ArrayState.d.ts +1 -1
  79. package/state/ArrayState.js +1 -1
  80. package/state/DataState.d.ts +2 -2
  81. package/state/DataState.js +1 -1
  82. package/state/DictionaryState.d.ts +2 -2
  83. package/state/DictionaryState.js +1 -1
  84. package/state/State.d.ts +1 -1
  85. package/state/State.js +1 -1
  86. package/test/basics.d.ts +1 -1
  87. package/test/basics.js +1 -1
  88. package/test/people.d.ts +1 -1
  89. package/test/util.d.ts +2 -2
  90. package/update/ArrayUpdate.d.ts +1 -1
  91. package/update/ArrayUpdate.js +1 -1
  92. package/update/DataUpdate.d.ts +3 -3
  93. package/update/DictionaryUpdate.d.ts +3 -3
  94. package/update/DictionaryUpdate.js +3 -3
  95. package/update/hydrations.d.ts +1 -1
  96. package/update/hydrations.js +3 -3
  97. package/util/activity.d.ts +1 -1
  98. package/util/array.d.ts +0 -4
  99. package/util/array.js +1 -8
  100. package/util/async.d.ts +1 -1
  101. package/util/class.d.ts +1 -1
  102. package/util/class.js +1 -1
  103. package/util/diff.d.ts +2 -2
  104. package/util/duration.d.ts +1 -1
  105. package/util/duration.js +1 -1
  106. package/util/entry.d.ts +3 -3
  107. package/util/equal.d.ts +3 -3
  108. package/util/equal.js +1 -1
  109. package/util/hydrate.d.ts +2 -2
  110. package/util/hydrate.js +1 -1
  111. package/util/iterate.d.ts +0 -4
  112. package/util/iterate.js +5 -7
  113. package/util/lazy.d.ts +1 -1
  114. package/util/map.d.ts +1 -1
  115. package/util/match.d.ts +6 -1
  116. package/util/match.js +13 -0
  117. package/util/merge.d.ts +2 -2
  118. package/util/object.d.ts +1 -1
  119. package/util/regexp.d.ts +2 -2
  120. package/util/sequence.d.ts +1 -1
  121. package/util/sort.d.ts +1 -1
  122. package/util/string.d.ts +1 -1
  123. package/util/string.js +2 -2
  124. package/util/template.d.ts +1 -1
  125. package/util/template.js +2 -2
  126. package/util/transform.d.ts +3 -3
  127. package/util/units.d.ts +4 -3
  128. package/util/units.js +2 -2
  129. package/util/validate.d.ts +3 -3
  130. package/util/validate.js +7 -7
@@ -1,4 +1,4 @@
1
- import { Handler, Arguments, Dispatch, Start } from "./function.js";
1
+ import type { Arguments, Dispatch, Handler, Start } from "./function.js";
2
2
  /** Something that can be started and stopped. */
3
3
  export interface Activity<A extends Arguments = []> {
4
4
  /** Start this activity. */
package/util/array.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import type { Arguments } from "./function.js";
2
- import type { Matcher } from "./match.js";
3
1
  /**
4
2
  * Mutable array: an array that can be changed.
5
3
  * - Consistency with `MutableObject<T>` and `ImmutableArray<T>`
@@ -28,8 +26,6 @@ export declare function withArrayItems<T>(arr: ImmutableArray<T>, ...items: T[])
28
26
  export declare function pickArrayItems<T>(input: ImmutableArray<T> | Iterable<T>, ...pick: T[]): ImmutableArray<T>;
29
27
  /** Remove multiple items from an array (immutably) and return a new array without those items (or the same array if no changes were made). */
30
28
  export declare function omitArrayItems<T>(input: ImmutableArray<T> | Iterable<T>, ...omit: T[]): ImmutableArray<T>;
31
- /** Filter an array using a matcher (and optionally a target value). */
32
- export declare function filterArray<T, A extends Arguments = []>(input: ImmutableArray<T>, matcher: Matcher<[T, ...A]>, ...args: A): ImmutableArray<T>;
33
29
  /** Clear an array (immutably) and return a new empty array (or the same array if no changes were made). */
34
30
  export declare const clearArray: <T>(input: ImmutableArray<T>) => ImmutableArray<T>;
35
31
  /** Toggle an item in and out of an array (immutably) and return a new array with or without the specified items (or the same array if no changes were made). */
package/util/array.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AssertionError } from "../error/AssertionError.js";
2
2
  import { RequiredError } from "../error/RequiredError.js";
3
- import { filterItems, omitItems, pickItems } from "./iterate.js";
3
+ import { omitItems, pickItems } from "./iterate.js";
4
4
  import { formatRange } from "./number.js";
5
5
  /** Is an unknown value an array? */
6
6
  export const isArray = (value) => Array.isArray(value);
@@ -33,13 +33,6 @@ export function omitArrayItems(input, ...omit) {
33
33
  const output = Array.from(omitItems(input, ...omit));
34
34
  return isArray(input) && output.length === input.length ? input : output;
35
35
  }
36
- /** Filter an array using a matcher (and optionally a target value). */
37
- export function filterArray(input, matcher, ...args) {
38
- if (!input.length)
39
- return input;
40
- const output = Array.from(filterItems(input, matcher, ...args));
41
- return output.length === input.length ? input : output;
42
- }
43
36
  /** Clear an array (immutably) and return a new empty array (or the same array if no changes were made). */
44
37
  export const clearArray = (input) => (input.length ? [] : input);
45
38
  /** Toggle an item in and out of an array (immutably) and return a new array with or without the specified items (or the same array if no changes were made). */
package/util/async.d.ts CHANGED
@@ -1,5 +1,5 @@
1
+ import type { Dispatch, Handler } from "./function.js";
1
2
  import { SIGNAL } from "./constants.js";
2
- import type { Handler, Dispatch } from "./function.js";
3
3
  /** Is a value an asynchronous value implementing a `then()` function. */
4
4
  export declare const isAsync: <T>(value: T | PromiseLike<T>) => value is PromiseLike<T>;
5
5
  /** Is a value a synchronous value. */
package/util/class.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Arguments } from "./function.js";
1
+ import type { Arguments } from "./function.js";
2
2
  /** Class that has a public `constructor()` function. */
3
3
  export type Constructor<T, A extends Arguments> = new (...args: A) => T;
4
4
  /** Any function arguments (designed for use with `extends Arguments` guards). */
package/util/class.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/ban-types */
2
2
  import { AssertionError } from "../error/AssertionError.js";
3
- import { assertFunction } from "./function.js";
4
3
  import { debug } from "./debug.js";
4
+ import { assertFunction } from "./function.js";
5
5
  export const abc = String;
6
6
  /** Is a given value a class constructor? */
7
7
  export const isConstructor = (value) => typeof value === "function" && value.toString().startsWith("class");
package/util/diff.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ImmutableArray } from "./array.js";
2
- import { ImmutableObject, DeepPartial } from "./object.js";
1
+ import type { ImmutableArray } from "./array.js";
2
+ import type { DeepPartial, ImmutableObject } from "./object.js";
3
3
  /** The `SAME` symbol indicates sameness. */
4
4
  export declare const SAME: unique symbol;
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { PossibleDate } from "./date.js";
1
+ import type { PossibleDate } from "./date.js";
2
2
  /** Format a full format of a duration of time using the most reasonable units e.g. `5 years` or `1 week` or `4 minutes` or `12 milliseconds`. */
3
3
  export declare function pluralizeDuration(ms: number): string;
4
4
  /** Format a description of a duration of time using the most reasonable units e.g. `5y` or `4m` or `12ms`. */
package/util/duration.js CHANGED
@@ -1,4 +1,4 @@
1
- import { MONTH, WEEK, DAY, HOUR, SECOND } from "./constants.js";
1
+ import { DAY, HOUR, MONTH, SECOND, WEEK } from "./constants.js";
2
2
  import { getDuration } from "./date.js";
3
3
  import { TIME_UNITS } from "./units.js";
4
4
  /** Get an appropriate time unit based on an amount in milliseconds. */
package/util/entry.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { ImmutableArray } from "./array.js";
2
- import { ImmutableObject } from "./object.js";
3
- import { ImmutableSet } from "./set.js";
1
+ import type { ImmutableArray } from "./array.js";
2
+ import type { ImmutableObject } from "./object.js";
3
+ import type { ImmutableSet } from "./set.js";
4
4
  /**
5
5
  * Single entry from a map-like object.
6
6
  * - Consistency with `UnknownObject`
package/util/equal.d.ts CHANGED
@@ -1,7 +1,7 @@
1
+ import type { ImmutableArray } from "./array.js";
2
+ import type { ImmutableMap } from "./map.js";
1
3
  import type { Match } from "./match.js";
2
- import { ImmutableArray } from "./array.js";
3
- import { ImmutableObject } from "./object.js";
4
- import { ImmutableMap } from "./map.js";
4
+ import type { ImmutableObject } from "./object.js";
5
5
  /** Is unknown value `left` exactly equal to `right`? */
6
6
  export declare const isEqual: <T>(left: unknown, right: T) => left is T;
7
7
  /** Is unknown value `left` not exactly equal to `right`? */
package/util/equal.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { isArray } from "./array.js";
2
- import { isObject, isProp } from "./object.js";
3
2
  import { isMap } from "./map.js";
3
+ import { isObject, isProp } from "./object.js";
4
4
  import { rankAsc } from "./sort.js";
5
5
  /** Is unknown value `left` exactly equal to `right`? */
6
6
  export const isEqual = (left, right) => left === right;
package/util/hydrate.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { ImmutableDictionary } from "./dictionary.js";
2
1
  import type { Class } from "./class.js";
3
- import { Transformable } from "./transform.js";
2
+ import type { ImmutableDictionary } from "./dictionary.js";
3
+ import type { Transformable } from "./transform.js";
4
4
  /**
5
5
  * A set of hydrations describes a set of string keys and the class constructor to be dehydrated and rehydrated.
6
6
  * - We can't use `class.name` because we don't know that the name of the class will survive minification.
package/util/hydrate.js CHANGED
@@ -5,7 +5,7 @@ import { isMap } from "./map.js";
5
5
  import { getPrototype, isObject, isPlainObject } from "./object.js";
6
6
  import { isSet } from "./set.js";
7
7
  import { isString } from "./string.js";
8
- import { mapArray, mapObject, mapEntries, mapItems } from "./transform.js";
8
+ import { mapArray, mapEntries, mapItems, mapObject } from "./transform.js";
9
9
  /**
10
10
  * Deeply dehydrate a class instance based on a set of `Hydrations`
11
11
  * - Dehydration allows you to pass class instances from a server back to a client.
package/util/iterate.d.ts CHANGED
@@ -3,8 +3,6 @@
3
3
  * - Any object with a `Symbol.iterator` property is iterable.
4
4
  * - Note: Array and Map instances etc will return true because they implement `Symbol.iterator`
5
5
  */
6
- import type { Arguments } from "./function.js";
7
- import { Matcher } from "./match.js";
8
6
  /** Is an unknown value an iterable? */
9
7
  export declare const isIterable: <T extends Iterable<unknown>>(value: unknown) => value is T;
10
8
  /** An iterable containing items or nested iterables of items. */
@@ -37,8 +35,6 @@ export declare function omitItems<T>(items: Iterable<T>, ...omit: T[]): Iterable
37
35
  /** Reduce an iterable set of items using a reducer function. */
38
36
  export declare function reduceItems<T>(items: Iterable<T>, reducer: (previous: T, item: T) => T, initial: T): T;
39
37
  export declare function reduceItems<T>(items: Iterable<T>, reducer: (previous: T | undefined, item: T) => T, initial?: T): T | undefined;
40
- /** Filter an iterable set of items using a matcher (and optionally a target value). */
41
- export declare function filterItems<T, A extends Arguments = []>(items: Iterable<T>, matcher: Matcher<[T, ...A]>, ...args: A): Iterable<T>;
42
38
  /** Yield chunks of a given size. */
43
39
  export declare function getChunks<T>(items: Iterable<T>, size: 1): Iterable<readonly [T]>;
44
40
  export declare function getChunks<T>(items: Iterable<T>, size: 2): Iterable<readonly [T, T]>;
package/util/iterate.js CHANGED
@@ -1,4 +1,8 @@
1
- import { match } from "./match.js";
1
+ /**
2
+ * Is a value an iterable object?
3
+ * - Any object with a `Symbol.iterator` property is iterable.
4
+ * - Note: Array and Map instances etc will return true because they implement `Symbol.iterator`
5
+ */
2
6
  /** Is an unknown value an iterable? */
3
7
  export const isIterable = (value) => typeof value === "object" && !!value && Symbol.iterator in value;
4
8
  /** Flatten one or more iterables. */
@@ -77,12 +81,6 @@ export function reduceItems(items, reducer, initial) {
77
81
  current = reducer(current, item);
78
82
  return current;
79
83
  }
80
- /** Filter an iterable set of items using a matcher (and optionally a target value). */
81
- export function* filterItems(items, matcher, ...args) {
82
- for (const item of items)
83
- if (match(matcher, item, ...args))
84
- yield item;
85
- }
86
84
  export function* getChunks(items, size) {
87
85
  let chunk = [];
88
86
  for (const item of items) {
package/util/lazy.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Arguments } from "./function.js";
1
+ import type { Arguments } from "./function.js";
2
2
  /**
3
3
  * Lazy value: a plain value, or an initialiser function that returns that value.
4
4
  * @param ...args Any arguments the lazy value needs if it's a function.
package/util/map.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Entry } from "./entry.js";
1
+ import type { Entry } from "./entry.js";
2
2
  /** `Map` that cannot be changed. */
3
3
  export type ImmutableMap<K = unknown, T = unknown> = ReadonlyMap<K, T>;
4
4
  /** Class for a `Map` that cannot be changed (so you can extend `Map` while implementing `ImmutableMap`). */
package/util/match.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { Arguments } from "./function.js";
1
+ import type { ImmutableArray } from "./array.js";
2
+ import type { Arguments } from "./function.js";
2
3
  /** Object that can match an item against a target with its `match()` function. */
3
4
  export interface Matchable<A extends Arguments = unknown[]> {
4
5
  match(...args: A): boolean;
@@ -9,3 +10,7 @@ export type Match<A extends Arguments = unknown[]> = (...args: A) => boolean;
9
10
  export type Matcher<A extends Arguments = unknown[]> = Matchable<A> | Match<A>;
10
11
  /** Match two values using a `Matcher`. */
11
12
  export declare function match<A extends Arguments>(matcher: Matcher<A>, ...args: A): boolean;
13
+ /** Filter an iterable set of items using a matcher. */
14
+ export declare function filterItems<T, A extends Arguments = []>(items: Iterable<T>, matcher: Matcher<[T, ...A]>, ...args: A): Iterable<T>;
15
+ /** Filter an array (immutably) using a matcher. */
16
+ export declare function filterArray<T, A extends Arguments = []>(input: ImmutableArray<T>, matcher: Matcher<[T, ...A]>, ...args: A): ImmutableArray<T>;
package/util/match.js CHANGED
@@ -2,3 +2,16 @@
2
2
  export function match(matcher, ...args) {
3
3
  return typeof matcher === "function" ? matcher(...args) : matcher.match(...args);
4
4
  }
5
+ /** Filter an iterable set of items using a matcher. */
6
+ export function* filterItems(items, matcher, ...args) {
7
+ for (const item of items)
8
+ if (match(matcher, item, ...args))
9
+ yield item;
10
+ }
11
+ /** Filter an array (immutably) using a matcher. */
12
+ export function filterArray(input, matcher, ...args) {
13
+ if (!input.length)
14
+ return input;
15
+ const output = Array.from(filterItems(input, matcher, ...args));
16
+ return output.length === input.length ? input : output;
17
+ }
package/util/merge.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ImmutableArray } from "./array.js";
2
- import { ImmutableObject } from "./object.js";
1
+ import type { ImmutableArray } from "./array.js";
2
+ import type { ImmutableObject } from "./object.js";
3
3
  type MergeRecursor = (left: unknown, right: unknown) => unknown;
4
4
  /**
5
5
  * Exact merge two unknown values.
package/util/object.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ImmutableArray } from "./array.js";
1
+ import type { ImmutableArray } from "./array.js";
2
2
  /** Any readonly object. */
3
3
  export type ImmutableObject<K extends PropertyKey = PropertyKey, T = unknown> = {
4
4
  readonly [KK in K]: T;
package/util/regexp.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Match } from "./match.js";
2
- import { NotString } from "./string.js";
1
+ import type { Match } from "./match.js";
2
+ import type { NotString } from "./string.js";
3
3
  /** Regular expression that always matches everything. */
4
4
  export declare const ALWAYS_REGEXP: RegExp;
5
5
  /** Regular expression that never matches anything. */
@@ -1,5 +1,5 @@
1
+ import type { AsyncDispatch, Dispatch, Handler, Stop } from "./function.js";
1
2
  import { SIGNAL } from "./constants.js";
2
- import { Handler, Stop, AsyncDispatch, Dispatch } from "./function.js";
3
3
  /**
4
4
  * Is a value an async iterable object?
5
5
  * - Any object with a `Symbol.iterator` property is iterable.
package/util/sort.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ImmutableArray } from "./array.js";
1
+ import type { ImmutableArray } from "./array.js";
2
2
  /** Object that can rank two values using its `rank()` function. */
3
3
  export interface Rankable<T> {
4
4
  rank(left: T, right: T): number;
package/util/string.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ImmutableArray } from "./array.js";
1
+ import type { ImmutableArray } from "./array.js";
2
2
  /**
3
3
  * Type that never matches the `string` type.
4
4
  * - `string` itself is iterable (iterating over its individual characters) and implements `Iterable<string>`
package/util/string.js CHANGED
@@ -1,9 +1,9 @@
1
1
  /* eslint-disable no-control-regex */
2
2
  import { AssertionError } from "../error/AssertionError.js";
3
- import { formatDate, isDate } from "./date.js";
4
- import { formatObject, isObject } from "./object.js";
5
3
  import { getArray, isArray } from "./array.js";
4
+ import { formatDate, isDate } from "./date.js";
6
5
  import { formatNumber, formatRange, isBetween } from "./number.js";
6
+ import { formatObject, isObject } from "./object.js";
7
7
  /** Is a value a string? */
8
8
  export const isString = (value) => typeof value === "string";
9
9
  /** Assert that a value is a string. */
@@ -1,5 +1,5 @@
1
- import type { NotString } from "./string.js";
2
1
  import type { ImmutableDictionary } from "./dictionary.js";
2
+ import type { NotString } from "./string.js";
3
3
  /** Template values in `{ placeholder: value }` format. */
4
4
  type TemplateValues = ImmutableDictionary<string>;
5
5
  /** Things that can be converted to the value for a named placeholder. */
package/util/template.js CHANGED
@@ -1,6 +1,6 @@
1
- import { isObject } from "./object.js";
2
- import { setMapItem } from "./map.js";
3
1
  import { EMPTY_DATA } from "./data.js";
2
+ import { setMapItem } from "./map.js";
3
+ import { isObject } from "./object.js";
4
4
  // RegExp to find named variables in several formats e.g. `:a`, `${b}`, `{{c}}` or `{d}`
5
5
  const R_PLACEHOLDERS = /(\*|:[a-z][a-z0-9]*|\$\{[a-z][a-z0-9]*\}|\{\{[a-z][a-z0-9]*\}\}|\{[a-z][a-z0-9]*\})/i;
6
6
  // Find actual name within template placeholder e.g. `${name}` → `name`
@@ -1,8 +1,8 @@
1
1
  import type { ArrayItem, ImmutableArray } from "./array.js";
2
+ import type { ImmutableDictionary, PossibleDictionary } from "./dictionary.js";
2
3
  import type { Entry } from "./entry.js";
3
- import { Arguments } from "./function.js";
4
- import { ImmutableObject, ObjectValue } from "./object.js";
5
- import { ImmutableDictionary, PossibleDictionary } from "./dictionary.js";
4
+ import type { Arguments } from "./function.js";
5
+ import type { ImmutableObject, ObjectValue } from "./object.js";
6
6
  /** Object that transforms an input value into an output value with its `transform()` method. */
7
7
  export interface Transformable<I, O, A extends Arguments = []> {
8
8
  transform(input: I, ...args: A): O;
package/util/units.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { ImmutableObject } from "./object.js";
2
- import { MapKey, ImmutableMap } from "./map.js";
3
- import { NumberOptions } from "./number.js";
1
+ import type { MapKey } from "./map.js";
2
+ import type { NumberOptions } from "./number.js";
3
+ import type { ImmutableObject } from "./object.js";
4
+ import { ImmutableMap } from "./map.js";
4
5
  /** Conversion from one unit to another (either an amount to multiple by, or a function to convert). */
5
6
  type Conversion = number | ((num: number) => number);
6
7
  /** Set of possible conversions for a set of items. */
package/util/units.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { ConditionError } from "../error/ConditionError.js";
2
2
  import { RequiredError } from "../error/RequiredError.js";
3
3
  import { DAY, HOUR, MILLION, MINUTE, MONTH, NNBSP, SECOND, WEEK, YEAR } from "./constants.js";
4
- import { getProps } from "./object.js";
5
4
  import { ImmutableMap } from "./map.js";
6
- import { pluralizeQuantity, formatQuantity } from "./number.js";
5
+ import { formatQuantity, pluralizeQuantity } from "./number.js";
6
+ import { getProps } from "./object.js";
7
7
  /** Convert an amount using a `Conversion. */
8
8
  const _convert = (amount, conversion) => (typeof conversion === "function" ? conversion(amount) : conversion === 1 ? amount : amount * conversion);
9
9
  /** Represent a unit. */
@@ -1,6 +1,6 @@
1
- import { ImmutableDictionary, PossibleDictionary } from "./dictionary.js";
2
- import { Data } from "./data.js";
3
- import { ImmutableArray, PossibleArray } from "./array.js";
1
+ import type { ImmutableArray, PossibleArray } from "./array.js";
2
+ import type { Data } from "./data.js";
3
+ import type { ImmutableDictionary, PossibleDictionary } from "./dictionary.js";
4
4
  /** Object that can validate an unknown value with its `validate()` method. */
5
5
  export interface Validatable<T> {
6
6
  /**
package/util/validate.js CHANGED
@@ -1,8 +1,8 @@
1
- import { isFeedback } from "../feedback/Feedback.js";
1
+ import { Feedback } from "../feedback/Feedback.js";
2
2
  import { Feedbacks } from "../feedback/Feedbacks.js";
3
- import { getDictionaryItems } from "./dictionary.js";
4
- import { getDataProps } from "./data.js";
5
3
  import { getLastItem, isArray } from "./array.js";
4
+ import { getDataProps } from "./data.js";
5
+ import { getDictionaryItems } from "./dictionary.js";
6
6
  import { isIterable } from "./iterate.js";
7
7
  /** Validate an unknown value with a validator. */
8
8
  export function validate(unsafeValue, validator) {
@@ -24,7 +24,7 @@ export function* validateItems(unsafeItems, validator) {
24
24
  yield validate(unsafeItem, validator);
25
25
  }
26
26
  catch (thrown) {
27
- if (!isFeedback(thrown))
27
+ if (!(thrown instanceof Feedback))
28
28
  throw thrown;
29
29
  feedbacks[index] = thrown;
30
30
  valid = false;
@@ -55,7 +55,7 @@ export function validateArray(unsafeArray, validator) {
55
55
  changed = true;
56
56
  }
57
57
  catch (thrown) {
58
- if (!isFeedback(thrown))
58
+ if (!(thrown instanceof Feedback))
59
59
  throw thrown;
60
60
  feedbacks[index] = thrown;
61
61
  valid = false;
@@ -85,7 +85,7 @@ export function validateDictionary(unsafeDictionary, validator) {
85
85
  changed = true;
86
86
  }
87
87
  catch (thrown) {
88
- if (!isFeedback(thrown))
88
+ if (!(thrown instanceof Feedback))
89
89
  throw thrown;
90
90
  feedbacks[key] = thrown;
91
91
  valid = false;
@@ -121,7 +121,7 @@ export function validateData(unsafeData, validators) {
121
121
  changed = true;
122
122
  }
123
123
  catch (thrown) {
124
- if (!isFeedback(thrown))
124
+ if (!(thrown instanceof Feedback))
125
125
  throw thrown;
126
126
  feedbacks[key] = thrown;
127
127
  valid = false;