shelving 1.158.0 → 1.158.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 (61) hide show
  1. package/db/CacheProvider.d.ts +1 -1
  2. package/db/Change.d.ts +1 -1
  3. package/db/ChangesProvider.d.ts +1 -1
  4. package/db/DebugProvider.d.ts +1 -1
  5. package/db/ItemStore.d.ts +1 -1
  6. package/db/MemoryProvider.d.ts +1 -1
  7. package/db/Provider.d.ts +1 -1
  8. package/db/Provider.js +1 -2
  9. package/db/QueryStore.d.ts +1 -1
  10. package/db/ThroughProvider.d.ts +1 -1
  11. package/db/ValidationProvider.d.ts +1 -1
  12. package/db/index.d.ts +5 -5
  13. package/db/index.js +7 -7
  14. package/error/BaseError.js +1 -1
  15. package/error/index.d.ts +1 -1
  16. package/error/index.js +1 -1
  17. package/firestore/client/FirestoreClientProvider.d.ts +1 -1
  18. package/firestore/lite/FirestoreLiteProvider.d.ts +1 -1
  19. package/firestore/server/FirestoreServerProvider.d.ts +1 -1
  20. package/markup/index.d.ts +2 -2
  21. package/markup/index.js +2 -2
  22. package/markup/render.js +2 -2
  23. package/markup/rule/code.js +1 -1
  24. package/markup/rule/fenced.js +2 -2
  25. package/markup/rule/heading.js +1 -1
  26. package/markup/rule/index.js +1 -2
  27. package/markup/rule/linebreak.js +1 -1
  28. package/markup/rule/ordered.js +2 -2
  29. package/markup/rule/separator.js +1 -1
  30. package/markup/rule/unordered.js +2 -2
  31. package/package.json +7 -7
  32. package/react/createDataContext.d.ts +1 -1
  33. package/schema/ArraySchema.d.ts +5 -1
  34. package/schema/ArraySchema.js +5 -1
  35. package/schema/DictionarySchema.d.ts +5 -1
  36. package/schema/DictionarySchema.js +5 -1
  37. package/schema/index.d.ts +5 -5
  38. package/schema/index.js +6 -6
  39. package/sequence/DeferredSequence.js +3 -1
  40. package/sequence/index.d.ts +1 -1
  41. package/sequence/index.js +1 -1
  42. package/store/ArrayStore.js +1 -2
  43. package/store/index.d.ts +2 -2
  44. package/store/index.js +2 -2
  45. package/util/array.d.ts +1 -1
  46. package/util/format.d.ts +1 -1
  47. package/util/format.js +2 -2
  48. package/util/function.d.ts +1 -1
  49. package/util/function.js +1 -1
  50. package/util/iterate.js +2 -2
  51. package/util/jwt.js +2 -2
  52. package/util/merge.d.ts +1 -1
  53. package/util/merge.js +1 -1
  54. package/util/number.js +1 -1
  55. package/util/query.js +1 -2
  56. package/util/random.d.ts +1 -1
  57. package/util/sequence.d.ts +1 -2
  58. package/util/set.d.ts +3 -3
  59. package/util/units.d.ts +5 -5
  60. package/util/units.js +28 -28
  61. package/util/url.js +1 -1
@@ -1,4 +1,4 @@
1
- import type { DataKey, Database } from "../util/data.js";
1
+ import type { Database, DataKey } from "../util/data.js";
2
2
  import type { Identifier, Items, OptionalItem } from "../util/item.js";
3
3
  import type { ItemQuery } from "../util/query.js";
4
4
  import type { Sourceable } from "../util/source.js";
package/db/Change.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { ImmutableArray } from "../util/array.js";
2
- import type { DataKey, Database } from "../util/data.js";
2
+ import type { Database, DataKey } from "../util/data.js";
3
3
  import type { Identifier } from "../util/item.js";
4
4
  import { type Nullish } from "../util/null.js";
5
5
  import type { ItemQuery } from "../util/query.js";
@@ -1,5 +1,5 @@
1
1
  import type { MutableArray } from "../util/array.js";
2
- import type { DataKey, Database } from "../util/data.js";
2
+ import type { Database, DataKey } from "../util/data.js";
3
3
  import type { Identifier } from "../util/item.js";
4
4
  import type { ItemQuery } from "../util/query.js";
5
5
  import type { Updates } from "../util/update.js";
@@ -1,4 +1,4 @@
1
- import type { DataKey, Database } from "../util/data.js";
1
+ import type { Database, DataKey } from "../util/data.js";
2
2
  import type { Identifier, Items, OptionalItem } from "../util/item.js";
3
3
  import type { ItemQuery } from "../util/query.js";
4
4
  import type { Updates } from "../util/update.js";
package/db/ItemStore.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { BooleanStore } from "../store/BooleanStore.js";
2
2
  import { OptionalDataStore } from "../store/DataStore.js";
3
- import type { DataKey, Database } from "../util/data.js";
3
+ import type { Database, DataKey } from "../util/data.js";
4
4
  import type { Identifier, Item } from "../util/item.js";
5
5
  import type { StopCallback } from "../util/start.js";
6
6
  import type { MemoryProvider } from "./MemoryProvider.js";
@@ -1,5 +1,5 @@
1
1
  import { DeferredSequence } from "../sequence/DeferredSequence.js";
2
- import type { Data, DataKey, Database } from "../util/data.js";
2
+ import type { Data, Database, DataKey } from "../util/data.js";
3
3
  import type { Identifier, Item, Items, OptionalItem } from "../util/item.js";
4
4
  import type { ItemQuery } from "../util/query.js";
5
5
  import type { Updates } from "../util/update.js";
package/db/Provider.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { DataKey, Database } from "../util/data.js";
1
+ import type { Database, DataKey } from "../util/data.js";
2
2
  import type { Identifier, Item, Items, OptionalItem } from "../util/item.js";
3
3
  import type { ItemQuery } from "../util/query.js";
4
4
  import type { Updates } from "../util/update.js";
package/db/Provider.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { RequiredError } from "../error/RequiredError.js";
2
- import { countArray } from "../util/array.js";
3
- import { getFirst } from "../util/array.js";
2
+ import { countArray, getFirst } from "../util/array.js";
4
3
  /** Provider with a fully synchronous interface */
5
4
  export class Provider {
6
5
  requireItem(collection, id) {
@@ -1,6 +1,6 @@
1
1
  import { ArrayStore } from "../store/ArrayStore.js";
2
2
  import { BooleanStore } from "../store/BooleanStore.js";
3
- import type { DataKey, Database } from "../util/data.js";
3
+ import type { Database, DataKey } from "../util/data.js";
4
4
  import type { Identifier, Item } from "../util/item.js";
5
5
  import type { ItemQuery } from "../util/query.js";
6
6
  import type { StopCallback } from "../util/start.js";
@@ -1,4 +1,4 @@
1
- import type { DataKey, Database } from "../util/data.js";
1
+ import type { Database, DataKey } from "../util/data.js";
2
2
  import type { Identifier, Item, Items, OptionalItem } from "../util/item.js";
3
3
  import type { ItemQuery } from "../util/query.js";
4
4
  import type { Sourceable } from "../util/source.js";
@@ -1,6 +1,6 @@
1
1
  import type { DataSchema, DataSchemas } from "../schema/DataSchema.js";
2
2
  import type { Schema } from "../schema/Schema.js";
3
- import type { DataKey, Database } from "../util/data.js";
3
+ import type { Database, DataKey } from "../util/data.js";
4
4
  import type { Identifier, Items, OptionalItem } from "../util/item.js";
5
5
  import type { ItemQuery } from "../util/query.js";
6
6
  import type { Sourceable } from "../util/source.js";
package/db/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- export * from "./ItemStore.js";
2
- export * from "./QueryStore.js";
3
- export * from "./Provider.js";
4
- export * from "./ThroughProvider.js";
5
1
  export * from "./CacheProvider.js";
2
+ export * from "./Change.js";
6
3
  export * from "./ChangesProvider.js";
7
4
  export * from "./DebugProvider.js";
5
+ export * from "./ItemStore.js";
8
6
  export * from "./MemoryProvider.js";
7
+ export * from "./Provider.js";
8
+ export * from "./QueryStore.js";
9
+ export * from "./ThroughProvider.js";
9
10
  export * from "./ValidationProvider.js";
10
- export * from "./Change.js";
package/db/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  // Stores.
2
- export * from "./ItemStore.js";
3
- export * from "./QueryStore.js";
4
- // Providers.
5
- export * from "./Provider.js";
6
- export * from "./ThroughProvider.js";
7
2
  export * from "./CacheProvider.js";
3
+ // Util.
4
+ export * from "./Change.js";
8
5
  export * from "./ChangesProvider.js";
9
6
  export * from "./DebugProvider.js";
7
+ export * from "./ItemStore.js";
10
8
  export * from "./MemoryProvider.js";
9
+ // Providers.
10
+ export * from "./Provider.js";
11
+ export * from "./QueryStore.js";
12
+ export * from "./ThroughProvider.js";
11
13
  export * from "./ValidationProvider.js";
12
- // Util.
13
- export * from "./Change.js";
@@ -2,7 +2,7 @@
2
2
  export class BaseError extends Error {
3
3
  constructor(message, options = {}) {
4
4
  super(message, options);
5
- const { cause, caller = BaseError, ...rest } = options;
5
+ const { _cause, caller = BaseError, ...rest } = options;
6
6
  for (const [key, value] of Object.entries(rest))
7
7
  this[key] = value;
8
8
  Error.captureStackTrace(this, caller);
package/error/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export * from "./BaseError.js";
2
2
  export * from "./NetworkError.js";
3
- export * from "./ResponseError.js";
4
3
  export * from "./RequestError.js";
5
4
  export * from "./RequiredError.js";
5
+ export * from "./ResponseError.js";
6
6
  export * from "./UnexpectedError.js";
7
7
  export * from "./UnimplementedError.js";
8
8
  export * from "./ValueError.js";
package/error/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  export * from "./BaseError.js";
2
2
  export * from "./NetworkError.js";
3
- export * from "./ResponseError.js";
4
3
  export * from "./RequestError.js";
5
4
  export * from "./RequiredError.js";
5
+ export * from "./ResponseError.js";
6
6
  export * from "./UnexpectedError.js";
7
7
  export * from "./UnimplementedError.js";
8
8
  export * from "./ValueError.js";
@@ -1,6 +1,6 @@
1
1
  import type { Firestore } from "firebase/firestore";
2
2
  import { AsyncProvider } from "../../db/Provider.js";
3
- import type { Data, DataKey, Database } from "../../util/data.js";
3
+ import type { Data, Database, DataKey } from "../../util/data.js";
4
4
  import type { Items, OptionalItem } from "../../util/item.js";
5
5
  import type { ItemQuery } from "../../util/query.js";
6
6
  import type { Updates } from "../../util/update.js";
@@ -1,6 +1,6 @@
1
1
  import type { Firestore } from "firebase/firestore/lite";
2
2
  import { AsyncProvider } from "../../db/Provider.js";
3
- import type { Data, DataKey, Database } from "../../util/data.js";
3
+ import type { Data, Database, DataKey } from "../../util/data.js";
4
4
  import type { Items, OptionalItem } from "../../util/item.js";
5
5
  import type { ItemQuery } from "../../util/query.js";
6
6
  import type { Updates } from "../../util/update.js";
@@ -1,6 +1,6 @@
1
1
  import { Firestore } from "@google-cloud/firestore";
2
2
  import { AsyncProvider } from "../../db/Provider.js";
3
- import type { DataKey, Database } from "../../util/data.js";
3
+ import type { Database, DataKey } from "../../util/data.js";
4
4
  import type { Items, OptionalItem } from "../../util/item.js";
5
5
  import type { ItemQuery } from "../../util/query.js";
6
6
  import type { Updates } from "../../util/update.js";
package/markup/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from "./util/options.js";
2
- export * from "./util/rule.js";
3
2
  export * from "./util/regexp.js";
4
- export * from "./rule/index.js";
3
+ export * from "./util/rule.js";
5
4
  export * from "./render.js";
5
+ export * from "./rule/index.js";
package/markup/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export * from "./util/options.js";
2
- export * from "./util/rule.js";
3
2
  export * from "./util/regexp.js";
3
+ export * from "./util/rule.js";
4
4
  // export * from "./util/internal.js"; // Not exported.
5
- export * from "./rule/index.js";
6
5
  export * from "./render.js";
6
+ export * from "./rule/index.js";
package/markup/render.js CHANGED
@@ -27,8 +27,8 @@ context,
27
27
  offset = 0) {
28
28
  // The best matched rule is the one with the highest priority.
29
29
  // If two have equal priority use the earliest match in the string.
30
- let bestMatch = undefined;
31
- let bestRule = undefined;
30
+ let bestMatch;
31
+ let bestRule;
32
32
  // Loop through all rules in the list and see if any match.
33
33
  for (const rule of options.rules) {
34
34
  const { priority, regexp, contexts } = rule;
@@ -10,7 +10,7 @@ const CODE_REGEXP = getRegExp(`(?<fence>\`+)(?<code>${BLOCK_CONTENT_REGEXP})\\k<
10
10
  * - Closing characters must exactly match opening characters.
11
11
  * - Same as Markdown syntax.
12
12
  */
13
- export const CODE_RULE = getMarkupRule(CODE_REGEXP, ({ groups: { code } }, options, key) => ({
13
+ export const CODE_RULE = getMarkupRule(CODE_REGEXP, ({ groups: { code } }, _options, key) => ({
14
14
  key,
15
15
  $$typeof: REACT_ELEMENT_TYPE,
16
16
  type: "code",
@@ -1,5 +1,5 @@
1
1
  import { REACT_ELEMENT_TYPE } from "../util/internal.js";
2
- import { BLOCK_CONTENT_REGEXP, BLOCK_START_REGEXP, LINE_CONTENT_REGEXP, LINE_SPACE_REGEXP, getBlockRegExp } from "../util/regexp.js";
2
+ import { BLOCK_CONTENT_REGEXP, BLOCK_START_REGEXP, getBlockRegExp, LINE_CONTENT_REGEXP, LINE_SPACE_REGEXP } from "../util/regexp.js";
3
3
  import { getMarkupRule } from "../util/rule.js";
4
4
  const FENCE = "`{3,}|~{3,}";
5
5
  const FENCED_REGEXP = getBlockRegExp(`(?<code>${BLOCK_CONTENT_REGEXP})`,
@@ -16,7 +16,7 @@ const FENCED_REGEXP = getBlockRegExp(`(?<code>${BLOCK_CONTENT_REGEXP})`,
16
16
  * - If there's no closing fence the code block will run to the end of the current string.
17
17
  * - Markdown-style four-space indent syntax is not supported (only fenced code since it's less confusing and more common).
18
18
  */
19
- export const FENCED_RULE = getMarkupRule(FENCED_REGEXP, ({ groups: { title, code } }, options, key) => ({
19
+ export const FENCED_RULE = getMarkupRule(FENCED_REGEXP, ({ groups: { title, code } }, _options, key) => ({
20
20
  key,
21
21
  $$typeof: REACT_ELEMENT_TYPE,
22
22
  type: "pre",
@@ -1,6 +1,6 @@
1
1
  import { renderMarkup } from "../render.js";
2
2
  import { REACT_ELEMENT_TYPE } from "../util/internal.js";
3
- import { LINE_CONTENT_REGEXP, LINE_SPACE_REGEXP, getLineRegExp } from "../util/regexp.js";
3
+ import { getLineRegExp, LINE_CONTENT_REGEXP, LINE_SPACE_REGEXP } from "../util/regexp.js";
4
4
  import { getMarkupRule } from "../util/rule.js";
5
5
  const HEADING_REGEXP = getLineRegExp(`(?<prefix>#{1,6})(?:${LINE_SPACE_REGEXP}+(?<heading>${LINE_CONTENT_REGEXP}))?`);
6
6
  /**
@@ -4,8 +4,7 @@ import { FENCED_RULE } from "./fenced.js";
4
4
  import { HEADING_RULE } from "./heading.js";
5
5
  import { INLINE_RULE } from "./inline.js";
6
6
  import { LINEBREAK_RULE } from "./linebreak.js";
7
- import { LINK_RULE } from "./link.js";
8
- import { AUTOLINK_RULE } from "./link.js";
7
+ import { AUTOLINK_RULE, LINK_RULE } from "./link.js";
9
8
  import { ORDERED_RULE } from "./ordered.js";
10
9
  import { PARAGRAPH_RULE } from "./paragraph.js";
11
10
  import { SEPARATOR_RULE } from "./separator.js";
@@ -10,7 +10,7 @@ import { getMarkupRule } from "../util/rule.js";
10
10
  * - This is more intuitive (a linebreak becomes a linebreak is isn't silently ignored).
11
11
  * - This works better with textareas that wrap text (since manually breaking up long lines is no longer necessary).
12
12
  */
13
- export const LINEBREAK_RULE = getMarkupRule(/[^\n\S]*\n[^\n\S]*/, (match, options, key) => ({
13
+ export const LINEBREAK_RULE = getMarkupRule(/[^\n\S]*\n[^\n\S]*/, (_match, _options, key) => ({
14
14
  key,
15
15
  $$typeof: REACT_ELEMENT_TYPE,
16
16
  type: "br",
@@ -1,6 +1,6 @@
1
1
  import { renderMarkup } from "../render.js";
2
2
  import { REACT_ELEMENT_TYPE } from "../util/internal.js";
3
- import { BLOCK_CONTENT_REGEXP, BLOCK_SPACE_REGEXP, LINE_SPACE_REGEXP, getBlockRegExp } from "../util/regexp.js";
3
+ import { BLOCK_CONTENT_REGEXP, BLOCK_SPACE_REGEXP, getBlockRegExp, LINE_SPACE_REGEXP } from "../util/regexp.js";
4
4
  import { getMarkupRule } from "../util/rule.js";
5
5
  const INDENT = /^\t/gm; // Nesting is recognised with tabs only.
6
6
  const NUMBER = "\\d{1,9}[.):]"; // Number for a numbered list, e.g. `1.` or `2)` or `3:` followed by one or more spaces.
@@ -24,7 +24,7 @@ export const ORDERED_RULE = getMarkupRule(ORDERED_REGEXP, ({ groups: { list } },
24
24
  /** Parse a markdown list into a set of items elements. */
25
25
  function* _getOrderedItems(list, options) {
26
26
  let key = 0;
27
- for (const [unused, number = "", item = ""] of list.matchAll(ITEM)) {
27
+ for (const [_unused, number = "", item = ""] of list.matchAll(ITEM)) {
28
28
  yield {
29
29
  $$typeof: REACT_ELEMENT_TYPE,
30
30
  type: "li",
@@ -9,7 +9,7 @@ const SEPARATOR_REGEXP = getLineRegExp("([-*•+_=])(?: *\\1){2,}");
9
9
  * - Character must be the same every time (can't mix)
10
10
  * - Might have infinite number of spaces between the characters.
11
11
  */
12
- export const SEPARATOR_RULE = getMarkupRule(SEPARATOR_REGEXP, (match, options, key) => ({
12
+ export const SEPARATOR_RULE = getMarkupRule(SEPARATOR_REGEXP, (_match, _options, key) => ({
13
13
  key,
14
14
  $$typeof: REACT_ELEMENT_TYPE,
15
15
  type: "hr",
@@ -1,6 +1,6 @@
1
1
  import { renderMarkup } from "../render.js";
2
2
  import { REACT_ELEMENT_TYPE } from "../util/internal.js";
3
- import { BLOCK_CONTENT_REGEXP, BLOCK_SPACE_REGEXP, LINE_SPACE_REGEXP, getBlockRegExp } from "../util/regexp.js";
3
+ import { BLOCK_CONTENT_REGEXP, BLOCK_SPACE_REGEXP, getBlockRegExp, LINE_SPACE_REGEXP } from "../util/regexp.js";
4
4
  import { getMarkupRule } from "../util/rule.js";
5
5
  const INDENT = /^\t/gm; // Nesting is recognised with tabs only.
6
6
  const BULLET = "[-*•+]"; // Allowed bullet symbol.
@@ -25,7 +25,7 @@ export const UNORDERED_RULE = getMarkupRule(UNORDERED_REGEXP, ({ groups: { list
25
25
  /** Parse a markdown list into a set of items elements. */
26
26
  export function* _getItems(list, options) {
27
27
  let key = 0;
28
- for (const [unused, item = ""] of list.matchAll(ITEM)) {
28
+ for (const [_unused, item = ""] of list.matchAll(ITEM)) {
29
29
  yield {
30
30
  $$typeof: REACT_ELEMENT_TYPE,
31
31
  type: "li",
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "state-management",
12
12
  "query-builder"
13
13
  ],
14
- "version": "1.158.0",
14
+ "version": "1.158.2",
15
15
  "repository": "https://github.com/dhoulb/shelving",
16
16
  "author": "Dave Houlbrooke <dave@shax.com>",
17
17
  "license": "0BSD",
@@ -57,14 +57,14 @@
57
57
  "build:test:unit": "bun test ./dist/**/*.test.js --bail"
58
58
  },
59
59
  "devDependencies": {
60
- "@biomejs/biome": "^1.9.4",
60
+ "@biomejs/biome": "^2.2.6",
61
61
  "@google-cloud/firestore": "^7.11.6",
62
- "@types/bun": "^1.2.23",
63
- "@types/react": "^19.1.16",
64
- "@types/react-dom": "^19.1.9",
62
+ "@types/bun": "^1.3.0",
63
+ "@types/react": "^19.2.2",
64
+ "@types/react-dom": "^19.2.2",
65
65
  "firebase": "^11.10.0",
66
- "react": "^19.1.1",
67
- "react-dom": "^19.1.1",
66
+ "react": "^19.2.0",
67
+ "react-dom": "^19.2.0",
68
68
  "typescript": "^5.9.3"
69
69
  },
70
70
  "peerDependencies": {
@@ -2,7 +2,7 @@ import type { ReactElement, ReactNode } from "react";
2
2
  import { ItemStore } from "../db/ItemStore.js";
3
3
  import type { AbstractProvider } from "../db/Provider.js";
4
4
  import { QueryStore } from "../db/QueryStore.js";
5
- import type { DataKey, Database } from "../util/data.js";
5
+ import type { Database, DataKey } from "../util/data.js";
6
6
  import type { Identifier } from "../util/item.js";
7
7
  import type { Nullish } from "../util/null.js";
8
8
  import type { ItemQuery } from "../util/query.js";
@@ -3,6 +3,8 @@ import type { SchemaOptions } from "./Schema.js";
3
3
  import { Schema } from "./Schema.js";
4
4
  /** Allowed options for `ArraySchema` */
5
5
  export interface ArraySchemaOptions<T> extends SchemaOptions {
6
+ readonly one?: string;
7
+ readonly many?: string;
6
8
  readonly value?: ImmutableArray;
7
9
  readonly items: Schema<T>;
8
10
  readonly min?: number;
@@ -38,11 +40,13 @@ export interface ArraySchemaOptions<T> extends SchemaOptions {
38
40
  */
39
41
  export declare class ArraySchema<T> extends Schema<ImmutableArray<T>> {
40
42
  readonly value: ImmutableArray;
43
+ readonly one: string;
44
+ readonly many: string;
41
45
  readonly items: Schema<T>;
42
46
  readonly unique: boolean;
43
47
  readonly min: number;
44
48
  readonly max: number;
45
- constructor({ items, unique, min, max, title, value, ...options }: ArraySchemaOptions<T>);
49
+ constructor({ items, one, many, unique, min, max, title, value, ...options }: ArraySchemaOptions<T>);
46
50
  validate(unsafeValue?: unknown): ImmutableArray<T>;
47
51
  }
48
52
  /** Valid array with specifed items. */
@@ -30,12 +30,16 @@ import { Schema } from "./Schema.js";
30
30
  * schema.validate(["a", null], schema); // Throws Invalids({ "1": Invalid('Must be a string') });
31
31
  */
32
32
  export class ArraySchema extends Schema {
33
+ one;
34
+ many;
33
35
  items;
34
36
  unique;
35
37
  min;
36
38
  max;
37
- constructor({ items, unique = false, min = 0, max = Number.POSITIVE_INFINITY, title = "Items", value = [], ...options }) {
39
+ constructor({ items, one = "item", many = `${one}s`, unique = false, min = 0, max = Number.POSITIVE_INFINITY, title = "Items", value = [], ...options }) {
38
40
  super({ title, value, ...options });
41
+ this.one = one;
42
+ this.many = many;
39
43
  this.items = items;
40
44
  this.unique = unique;
41
45
  this.min = min;
@@ -3,6 +3,8 @@ import type { SchemaOptions } from "./Schema.js";
3
3
  import { Schema } from "./Schema.js";
4
4
  /** Allowed options for `DictionarySchema` */
5
5
  export interface DictionarySchemaOptions<T> extends SchemaOptions {
6
+ readonly one?: string;
7
+ readonly many?: string;
6
8
  readonly items: Schema<T>;
7
9
  readonly value?: ImmutableDictionary | undefined;
8
10
  readonly min?: number | undefined;
@@ -11,10 +13,12 @@ export interface DictionarySchemaOptions<T> extends SchemaOptions {
11
13
  /** Validate a dictionary object (whose props are all the same with string keys). */
12
14
  export declare class DictionarySchema<T> extends Schema<ImmutableDictionary<T>> {
13
15
  readonly value: ImmutableDictionary;
16
+ readonly one: string;
17
+ readonly many: string;
14
18
  readonly items: Schema<T>;
15
19
  readonly min: number;
16
20
  readonly max: number;
17
- constructor({ items, min, max, title, value, ...options }: DictionarySchemaOptions<T>);
21
+ constructor({ items, one, many, min, max, title, value, ...options }: DictionarySchemaOptions<T>);
18
22
  validate(unsafeValue?: unknown): ImmutableDictionary<T>;
19
23
  }
20
24
  /** Valid dictionary object with specifed items. */
@@ -4,11 +4,15 @@ import { validateDictionary } from "../util/validate.js";
4
4
  import { Schema } from "./Schema.js";
5
5
  /** Validate a dictionary object (whose props are all the same with string keys). */
6
6
  export class DictionarySchema extends Schema {
7
+ one;
8
+ many;
7
9
  items;
8
10
  min;
9
11
  max;
10
- constructor({ items, min = 0, max = Number.POSITIVE_INFINITY, title = "Items", value = {}, ...options }) {
12
+ constructor({ items, one = "item", many = "items", min = 0, max = Number.POSITIVE_INFINITY, title = "Items", value = {}, ...options }) {
11
13
  super({ title, value, ...options });
14
+ this.one = one;
15
+ this.many = many;
12
16
  this.items = items;
13
17
  this.min = min;
14
18
  this.max = max;
package/schema/index.d.ts CHANGED
@@ -1,8 +1,3 @@
1
- export * from "./Schema.js";
2
- export * from "./ThroughSchema.js";
3
- export * from "./NullableSchema.js";
4
- export * from "./OptionalSchema.js";
5
- export * from "./RequiredSchema.js";
6
1
  export * from "./ArraySchema.js";
7
2
  export * from "./BooleanSchema.js";
8
3
  export * from "./ChoiceSchema.js";
@@ -16,9 +11,14 @@ export * from "./EntitySchema.js";
16
11
  export * from "./FileSchema.js";
17
12
  export * from "./KeySchema.js";
18
13
  export * from "./LinkSchema.js";
14
+ export * from "./NullableSchema.js";
19
15
  export * from "./NumberSchema.js";
16
+ export * from "./OptionalSchema.js";
20
17
  export * from "./PhoneSchema.js";
18
+ export * from "./RequiredSchema.js";
19
+ export * from "./Schema.js";
21
20
  export * from "./SlugSchema.js";
22
21
  export * from "./StringSchema.js";
22
+ export * from "./ThroughSchema.js";
23
23
  export * from "./TimeSchema.js";
24
24
  export * from "./UUIDSchema.js";
package/schema/index.js CHANGED
@@ -1,9 +1,3 @@
1
- export * from "./Schema.js";
2
- // Utility schemas.
3
- export * from "./ThroughSchema.js";
4
- export * from "./NullableSchema.js";
5
- export * from "./OptionalSchema.js";
6
- export * from "./RequiredSchema.js";
7
1
  // Field schemas.
8
2
  export * from "./ArraySchema.js";
9
3
  export * from "./BooleanSchema.js";
@@ -18,9 +12,15 @@ export * from "./EntitySchema.js";
18
12
  export * from "./FileSchema.js";
19
13
  export * from "./KeySchema.js";
20
14
  export * from "./LinkSchema.js";
15
+ export * from "./NullableSchema.js";
21
16
  export * from "./NumberSchema.js";
17
+ export * from "./OptionalSchema.js";
22
18
  export * from "./PhoneSchema.js";
19
+ export * from "./RequiredSchema.js";
20
+ export * from "./Schema.js";
23
21
  export * from "./SlugSchema.js";
24
22
  export * from "./StringSchema.js";
23
+ // Utility schemas.
24
+ export * from "./ThroughSchema.js";
25
25
  export * from "./TimeSchema.js";
26
26
  export * from "./UUIDSchema.js";
@@ -40,7 +40,9 @@ export class DeferredSequence extends AbstractSequence {
40
40
  }
41
41
  /** Fulfill the current deferred by resolving or rejecting it. */
42
42
  _fulfill() {
43
- const { _deferred, _nextReason, _nextValue } = this;
43
+ const _deferred = this._deferred;
44
+ const _nextReason = this._nextReason;
45
+ const _nextValue = this._nextValue;
44
46
  this._nextReason = _NOVALUE;
45
47
  this._nextValue = _NOVALUE;
46
48
  if (_deferred) {
@@ -1,6 +1,6 @@
1
1
  export * from "./AbstractSequence.js";
2
2
  export * from "./DeferredSequence.js";
3
3
  export * from "./InspectSequence.js";
4
+ export * from "./IteratorSequence.js";
4
5
  export * from "./LazyDeferredSequence.js";
5
6
  export * from "./ThroughSequence.js";
6
- export * from "./IteratorSequence.js";
package/sequence/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export * from "./AbstractSequence.js";
2
2
  export * from "./DeferredSequence.js";
3
3
  export * from "./InspectSequence.js";
4
+ export * from "./IteratorSequence.js";
4
5
  export * from "./LazyDeferredSequence.js";
5
6
  export * from "./ThroughSequence.js";
6
- export * from "./IteratorSequence.js";
@@ -1,5 +1,4 @@
1
- import { omitArrayItems, toggleArrayItems, withArrayItems } from "../util/array.js";
2
- import { getFirst, getLast, requireFirst, requireLast } from "../util/array.js";
1
+ import { getFirst, getLast, omitArrayItems, requireFirst, requireLast, toggleArrayItems, withArrayItems } from "../util/array.js";
3
2
  import { Store } from "./Store.js";
4
3
  /** Store an array. */
5
4
  export class ArrayStore extends Store {
package/store/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export * from "./Store.js";
2
1
  export * from "./ArrayStore.js";
3
2
  export * from "./BooleanStore.js";
4
3
  export * from "./DataStore.js";
5
- export * from "./PathStore.js";
6
4
  export * from "./DictionaryStore.js";
5
+ export * from "./PathStore.js";
6
+ export * from "./Store.js";
package/store/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export * from "./Store.js";
2
1
  export * from "./ArrayStore.js";
3
2
  export * from "./BooleanStore.js";
4
3
  export * from "./DataStore.js";
5
- export * from "./PathStore.js";
6
4
  export * from "./DictionaryStore.js";
5
+ export * from "./PathStore.js";
6
+ export * from "./Store.js";
package/util/array.d.ts CHANGED
@@ -27,7 +27,7 @@ export declare function isArray<T>(arr: ImmutableArray<T>, min: 3, max: 3): arr
27
27
  export declare function isArray<T>(arr: ImmutableArray<T>, min?: 1, max?: number): arr is readonly [T, ...T[]];
28
28
  export declare function isArray<T>(arr: ImmutableArray<T>, min: 2, max?: number): arr is readonly [T, T, ...T[]];
29
29
  export declare function isArray<T>(arr: ImmutableArray<T>, min: 3, max?: number): arr is readonly [T, T, T, ...T[]];
30
- export declare function isArray<T>(value: unknown, min?: number, max?: number): value is ImmutableArray;
30
+ export declare function isArray<T>(value: unknown, min?: number, max?: number): value is ImmutableArray<T>;
31
31
  /** Assert that an unknown value is an array (optionally with specified min/max length). */
32
32
  export declare function assertArray<T>(arr: MutableArray<T>, min: 1, max: 1, caller?: AnyCaller): asserts arr is [T];
33
33
  export declare function assertArray<T>(arr: MutableArray<T>, min: 2, max: 2, caller?: AnyCaller): asserts arr is [T, T];
package/util/format.d.ts CHANGED
@@ -9,7 +9,7 @@ export declare function formatQuantity(num: number, suffix: string, options?: In
9
9
  /** Format a number (based on the user's browser language settings). */
10
10
  export declare function formatNumber(num: number, options?: Intl.NumberFormatOptions): string;
11
11
  /** Format a number with a longer full-word suffix. */
12
- export declare function pluralizeQuantity(num: number, singular: string, plural: string, options?: Intl.NumberFormatOptions): string;
12
+ export declare function pluralizeQuantity(num: number, one: string, many: string, options?: Intl.NumberFormatOptions): string;
13
13
  /**
14
14
  * Format a percentage (combines `getPercent()` and `formatQuantity()` for convenience).
15
15
  * - Defaults to showing no decimal places.
package/util/format.js CHANGED
@@ -22,12 +22,12 @@ export function formatNumber(num, options) {
22
22
  return new Intl.NumberFormat(undefined, options).format(num).replace(/ /, NNBSP);
23
23
  }
24
24
  /** Format a number with a longer full-word suffix. */
25
- export function pluralizeQuantity(num, singular, plural, options) {
25
+ export function pluralizeQuantity(num, one, many, options) {
26
26
  const qty = formatNumber(num, {
27
27
  ...options,
28
28
  style: "decimal",
29
29
  });
30
- return `${qty}${NNBSP}${num === 1 ? singular : plural}`;
30
+ return `${qty}${NNBSP}${num === 1 ? one : many}`;
31
31
  }
32
32
  /**
33
33
  * Format a percentage (combines `getPercent()` and `formatQuantity()` for convenience).
@@ -14,4 +14,4 @@ export type Arguments = readonly unknown[];
14
14
  /** Function that just passes through the first argument. */
15
15
  export declare function PASSTHROUGH<T>(value: T): T;
16
16
  /** Function that does nothing with its arguments and always returns void. */
17
- export declare function BLACKHOLE(...unused: Arguments): void | undefined;
17
+ export declare function BLACKHOLE(..._unused: Arguments): void | undefined;
package/util/function.js CHANGED
@@ -14,6 +14,6 @@ export function PASSTHROUGH(value) {
14
14
  }
15
15
  /** Function that does nothing with its arguments and always returns void. */
16
16
  // biome-ignore lint/suspicious/noConfusingVoidType: Allow `BLACKHOLE` to be used in places that allow `void`
17
- export function BLACKHOLE(...unused) {
17
+ export function BLACKHOLE(..._unused) {
18
18
  return undefined;
19
19
  }
package/util/iterate.js CHANGED
@@ -13,14 +13,14 @@ export function* flattenItems(items) {
13
13
  * - Checks `items.size` or `items.length` first, or consumes the iterable and counts its iterations.
14
14
  */
15
15
  export function hasItems(items) {
16
- for (const unused of items)
16
+ for (const _unused of items)
17
17
  return true;
18
18
  return false;
19
19
  }
20
20
  /** Count the number of items in an iterable. */
21
21
  export function countItems(items) {
22
22
  let count = 0;
23
- for (const unused of items)
23
+ for (const _unused of items)
24
24
  count++;
25
25
  return count;
26
26
  }
package/util/jwt.js CHANGED
@@ -84,9 +84,9 @@ export async function verifyToken(token, secret, caller = verifyToken) {
84
84
  const { header, payload, signature, headerData, payloadData } = splitToken(token, caller);
85
85
  // Validate header.
86
86
  if (headerData.typ !== HEADER.typ)
87
- throw new UnauthorizedError(`JWT header type must be \"${HEADER.typ}\"`, { received: headerData.typ, caller });
87
+ throw new UnauthorizedError(`JWT header type must be "${HEADER.typ}"`, { received: headerData.typ, caller });
88
88
  if (headerData.alg !== HEADER.alg)
89
- throw new UnauthorizedError(`JWT header algorithm must be \"${HEADER.alg}\"`, { received: headerData.alg, caller });
89
+ throw new UnauthorizedError(`JWT header algorithm must be "${HEADER.alg}"`, { received: headerData.alg, caller });
90
90
  // Validate signature.
91
91
  const key = await _getKey(verifyToken, secret, "verify");
92
92
  const isValid = await crypto.subtle.verify("HMAC", key, decodeBase64URLBytes(signature), requireBytes(`${header}.${payload}`));
package/util/merge.d.ts CHANGED
@@ -5,7 +5,7 @@ type MergeRecursor = (left: unknown, right: unknown) => unknown;
5
5
  * Exact merge two unknown values.
6
6
  * - Always returns `right`.
7
7
  */
8
- export declare function exactMerge(left: unknown, right: unknown): unknown;
8
+ export declare function exactMerge(_left: unknown, right: unknown): unknown;
9
9
  /**
10
10
  * Shallow merge two unknown values.
11
11
  *
package/util/merge.js CHANGED
@@ -14,7 +14,7 @@ function _merge(left, right, recursor) {
14
14
  * Exact merge two unknown values.
15
15
  * - Always returns `right`.
16
16
  */
17
- export function exactMerge(left, right) {
17
+ export function exactMerge(_left, right) {
18
18
  return right;
19
19
  }
20
20
  export function shallowMerge(left, right) {
package/util/number.js CHANGED
@@ -158,7 +158,7 @@ export function sumNumbers(nums) {
158
158
  }
159
159
  /** Find the number that's closest to a target in an iterable set of numbers. */
160
160
  export function getClosestNumber(nums, target) {
161
- let closest = undefined;
161
+ let closest;
162
162
  for (const item of nums)
163
163
  if (closest === undefined || Math.abs(item - target) < Math.abs(closest - target))
164
164
  closest = item;
package/util/query.js CHANGED
@@ -1,5 +1,4 @@
1
- import { isArray, limitArray } from "./array.js";
2
- import { requireLast } from "./array.js";
1
+ import { isArray, limitArray, requireLast } from "./array.js";
3
2
  import { getDataProp } from "./data.js";
4
3
  import { isArrayWith, isEqual, isEqualGreater, isEqualLess, isGreater, isInArray, isLess, notEqual, notInArray } from "./equal.js";
5
4
  import { limitItems } from "./iterate.js";
package/util/random.d.ts CHANGED
@@ -13,4 +13,4 @@ export declare function getRandomKey(length?: number): string;
13
13
  /** Get a random character from a string. */
14
14
  export declare function getRandomCharacter(str: string): string;
15
15
  /** Get a random item from an array or random character from a string string. */
16
- export declare function getRandomItem<I, T>(arr: ImmutableArray<T>): T;
16
+ export declare function getRandomItem<T>(arr: ImmutableArray<T>): T;
@@ -1,5 +1,4 @@
1
- import type { AsyncValueCallback, ValueCallback } from "./callback.js";
2
- import type { ErrorCallback } from "./callback.js";
1
+ import type { AsyncValueCallback, ErrorCallback, ValueCallback } from "./callback.js";
3
2
  import { STOP } from "./constants.js";
4
3
  import type { StopCallback } from "./start.js";
5
4
  /**
package/util/set.d.ts CHANGED
@@ -16,11 +16,11 @@ export declare function getSet<T>(value: PossibleSet<T>): ImmutableSet;
16
16
  /** Apply a limit to a set. */
17
17
  export declare function limitSet<T>(set: ImmutableSet<T>, limit: number): ImmutableSet<T>;
18
18
  /** Is an unknown value an item in a set? */
19
- export declare function isSetItem<I, T>(set: ImmutableSet<T>, item: unknown): item is T;
19
+ export declare function isSetItem<T>(set: ImmutableSet<T>, item: unknown): item is T;
20
20
  /** Assert that an unknown value is an item in a set. */
21
- export declare function assertSetItem<I, T>(set: ImmutableSet<T>, item: unknown, caller?: AnyCaller): asserts item is T;
21
+ export declare function assertSetItem<T>(set: ImmutableSet<T>, item: unknown, caller?: AnyCaller): asserts item is T;
22
22
  /** Add an item to a set (by reference) and return the set item. */
23
- export declare function addSetItem<I, T>(set: MutableSet<T>, item: T): T;
23
+ export declare function addSetItem<T>(set: MutableSet<T>, item: T): T;
24
24
  /** Add multiple items to a set (by reference). */
25
25
  export declare function addSetItems<T>(set: MutableSet<T>, ...items: T[]): void;
26
26
  /** Remove multiple items from a set (by reference). */
package/util/units.d.ts CHANGED
@@ -10,9 +10,9 @@ type UnitProps<T extends string> = {
10
10
  /** Short abbreviation for this unit, e.g. `km` (defaults to first letter of `id`). */
11
11
  readonly abbr?: string;
12
12
  /** Singular name for this unit, e.g. `kilometer` (defaults to `id` + "s"). */
13
- readonly singular?: string;
13
+ readonly one?: string;
14
14
  /** Plural name for this unit, e.g. `kilometers` (defaults to `id`). */
15
- readonly plural?: string;
15
+ readonly many?: string;
16
16
  /** Conversions to other units (typically needs at least the base conversion, unless it's already the base unit). */
17
17
  readonly to?: Conversions<T>;
18
18
  /** Possible options for formatting these units with `Intl.NumberFormat` (`.unit` can be specified if different from key, but is not required). */
@@ -28,9 +28,9 @@ export declare class Unit<K extends string> {
28
28
  /** Short abbreviation for this unit, e.g. `km` (defaults to first letter of `id`). */
29
29
  readonly abbr: string;
30
30
  /** Singular name for this unit, e.g. `kilometer` (defaults to `id`). */
31
- readonly singular: string;
31
+ readonly one: string;
32
32
  /** Plural name for this unit, e.g. `kilometers` (defaults to `singular` + "s"). */
33
- readonly plural: string;
33
+ readonly many: string;
34
34
  /** Possible options for formatting these units with `Intl.NumberFormat` (`.unit` can be specified if different from key, but is not required). */
35
35
  readonly options: Readonly<Intl.NumberFormatOptions> | undefined;
36
36
  /** Title for this unit (uses format `abbr (plural)`, e.g. `fl oz (US fluid ounces)`) */
@@ -41,7 +41,7 @@ export declare class Unit<K extends string> {
41
41
  /** String key for this unit, e.g. `kilometer` */
42
42
  key: K,
43
43
  /** Props to configure this unit. */
44
- { abbr, singular, plural, options, to }: UnitProps<K>);
44
+ { abbr, one, many, options, to }: UnitProps<K>);
45
45
  /** Convert an amount from this unit to another unit. */
46
46
  to(amount: number, targetKey?: K): number;
47
47
  /** Convert an amount from another unit to this unit. */
package/util/units.js CHANGED
@@ -18,14 +18,14 @@ export class Unit {
18
18
  /** Short abbreviation for this unit, e.g. `km` (defaults to first letter of `id`). */
19
19
  abbr;
20
20
  /** Singular name for this unit, e.g. `kilometer` (defaults to `id`). */
21
- singular;
21
+ one;
22
22
  /** Plural name for this unit, e.g. `kilometers` (defaults to `singular` + "s"). */
23
- plural;
23
+ many;
24
24
  /** Possible options for formatting these units with `Intl.NumberFormat` (`.unit` can be specified if different from key, but is not required). */
25
25
  options;
26
26
  /** Title for this unit (uses format `abbr (plural)`, e.g. `fl oz (US fluid ounces)`) */
27
27
  get title() {
28
- return `${this.abbr} (${this.plural})`;
28
+ return `${this.abbr} (${this.many})`;
29
29
  }
30
30
  constructor(
31
31
  /** `UnitList` this unit belongs to. */
@@ -33,12 +33,12 @@ export class Unit {
33
33
  /** String key for this unit, e.g. `kilometer` */
34
34
  key,
35
35
  /** Props to configure this unit. */
36
- { abbr = key.slice(0, 1), singular = key.replace(/-/, " "), plural = `${singular}s`, options, to }) {
36
+ { abbr = key.slice(0, 1), one = key.replace(/-/, " "), many = `${one}s`, options, to }) {
37
37
  this.list = list;
38
38
  this.key = key;
39
39
  this.abbr = abbr;
40
- this.singular = singular;
41
- this.plural = plural;
40
+ this.one = one;
41
+ this.many = many;
42
42
  this.options = options;
43
43
  this._to = to;
44
44
  }
@@ -89,7 +89,7 @@ export class Unit {
89
89
  // Otherwise, use the default number format.
90
90
  // If unitDisplay is "long" use the singular/plural form.
91
91
  const o = { style: "decimal", unitDisplay: "short", ...this.options, ...options };
92
- return o.unitDisplay === "long" ? pluralizeQuantity(amount, this.singular, this.plural, o) : formatQuantity(amount, this.abbr, o);
92
+ return o.unitDisplay === "long" ? pluralizeQuantity(amount, this.one, this.many, o) : formatQuantity(amount, this.abbr, o);
93
93
  }
94
94
  }
95
95
  /**
@@ -155,7 +155,7 @@ const US_IN3_PER_GAL = 231;
155
155
  const IMP_ML_PER_GAL = 4546090 / 1000;
156
156
  /** Percentage units. */
157
157
  export const PERCENT_UNITS = new UnitList({
158
- percent: { abbr: "%", plural: "percent" },
158
+ percent: { abbr: "%", many: "percent" },
159
159
  });
160
160
  /** Point units. */
161
161
  export const POINT_UNITS = new UnitList({
@@ -177,7 +177,7 @@ export const MASS_UNITS = new UnitList({
177
177
  // Imperial.
178
178
  ounce: { abbr: "oz", to: { milligram: MG_PER_LB / OZ_PER_LB } },
179
179
  pound: { abbr: "lb", to: { milligram: MG_PER_LB, ounce: OZ_PER_LB } },
180
- stone: { abbr: "st", plural: "stone", to: { milligram: MG_PER_LB * LB_PER_ST, pound: LB_PER_ST, ounce: OZ_PER_LB * LB_PER_ST } },
180
+ stone: { abbr: "st", many: "stone", to: { milligram: MG_PER_LB * LB_PER_ST, pound: LB_PER_ST, ounce: OZ_PER_LB * LB_PER_ST } },
181
181
  });
182
182
  const TIME_OPTIONS = {
183
183
  roundingMode: "trunc",
@@ -202,8 +202,8 @@ export const LENGTH_UNITS = new UnitList({
202
202
  meter: { to: { millimeter: MM_PER_M } },
203
203
  kilometer: { abbr: "km", to: { millimeter: MM_PER_KM } },
204
204
  // Imperial.
205
- inch: { abbr: "in", plural: "inches", to: { millimeter: MM_PER_IN } },
206
- foot: { abbr: "ft", plural: "feet", to: { millimeter: IN_PER_FT * MM_PER_IN, inch: IN_PER_FT } },
205
+ inch: { abbr: "in", many: "inches", to: { millimeter: MM_PER_IN } },
206
+ foot: { abbr: "ft", many: "feet", to: { millimeter: IN_PER_FT * MM_PER_IN, inch: IN_PER_FT } },
207
207
  yard: { abbr: "yd", to: { millimeter: IN_PER_YD * MM_PER_IN, inch: IN_PER_YD, foot: FT_PER_YD } },
208
208
  furlong: { abbr: "fur", to: { millimeter: IN_PER_YD * MM_PER_IN * YD_PER_FUR, foot: YD_PER_FUR * FT_PER_YD, yard: YD_PER_FUR } },
209
209
  mile: { abbr: "mi", to: { millimeter: MM_PER_MI, yard: YD_PER_MI, foot: FT_PER_MI, inch: IN_PER_MI } },
@@ -211,15 +211,15 @@ export const LENGTH_UNITS = new UnitList({
211
211
  /** Speed units. */
212
212
  export const SPEED_UNITS = new UnitList({
213
213
  // Metric.
214
- "meter-per-second": { abbr: "m/s", singular: "meter per second", plural: "meters per second", to: { "kilometer-per-hour": 3.6 } },
214
+ "meter-per-second": { abbr: "m/s", one: "meter per second", many: "meters per second", to: { "kilometer-per-hour": 3.6 } },
215
215
  "kilometer-per-hour": {
216
216
  abbr: "kph",
217
- singular: "kilometer per hour",
218
- plural: "kilometers per hour",
217
+ one: "kilometer per hour",
218
+ many: "kilometers per hour",
219
219
  to: { "meter-per-second": MM_PER_KM / HOUR },
220
220
  },
221
221
  // Imperial.
222
- "mile-per-hour": { abbr: "mph", singular: "mile per hour", plural: "miles per hour", to: { "meter-per-second": MM_PER_MI / HOUR } },
222
+ "mile-per-hour": { abbr: "mph", one: "mile per hour", many: "miles per hour", to: { "meter-per-second": MM_PER_MI / HOUR } },
223
223
  });
224
224
  /** Area units. */
225
225
  export const AREA_UNITS = new UnitList({
@@ -230,10 +230,10 @@ export const AREA_UNITS = new UnitList({
230
230
  "square-kilometer": { abbr: "km²", to: { "square-millimeter": MM_PER_KM ** 2 } },
231
231
  hectare: { abbr: "ha", to: { "square-millimeter": (MM_PER_M * 100) ** 2 } },
232
232
  // Imperial.
233
- "square-inch": { abbr: "in²", plural: "square inches", to: { "square-millimeter": MM2_PER_IN2 } },
233
+ "square-inch": { abbr: "in²", many: "square inches", to: { "square-millimeter": MM2_PER_IN2 } },
234
234
  "square-foot": {
235
235
  abbr: "ft²",
236
- plural: "square feet",
236
+ many: "square feet",
237
237
  to: { "square-millimeter": IN_PER_FT ** 2 * MM2_PER_IN2, "square-inch": IN_PER_FT ** 2 },
238
238
  },
239
239
  "square-yard": {
@@ -255,19 +255,19 @@ export const VOLUME_UNITS = new UnitList({
255
255
  // US.
256
256
  "us-fluid-ounce": {
257
257
  abbr: `fl${NNBSP}oz`,
258
- singular: "US fluid ounce",
259
- plural: "US fluid ounces",
258
+ one: "US fluid ounce",
259
+ many: "US fluid ounces",
260
260
  to: { milliliter: (US_IN3_PER_GAL * ML_PER_IN3) / 128 },
261
261
  },
262
- "us-pint": { abbr: "pt", singular: "US pint", to: { milliliter: (US_IN3_PER_GAL * ML_PER_IN3) / 8, "us-fluid-ounce": 16 } },
262
+ "us-pint": { abbr: "pt", one: "US pint", to: { milliliter: (US_IN3_PER_GAL * ML_PER_IN3) / 8, "us-fluid-ounce": 16 } },
263
263
  "us-quart": {
264
264
  abbr: "qt",
265
- singular: "US quart",
265
+ one: "US quart",
266
266
  to: { milliliter: (US_IN3_PER_GAL * ML_PER_IN3) / 4, "us-pint": 2, "us-fluid-ounce": 32 },
267
267
  },
268
268
  "us-gallon": {
269
269
  abbr: "gal",
270
- singular: "US gallon",
270
+ one: "US gallon",
271
271
  to: { milliliter: US_IN3_PER_GAL * ML_PER_IN3, "us-quart": 4, "us-pint": 8, "us-fluid-ounce": 128 },
272
272
  },
273
273
  // Imperial.
@@ -278,8 +278,8 @@ export const VOLUME_UNITS = new UnitList({
278
278
  abbr: "gal",
279
279
  to: { milliliter: IMP_ML_PER_GAL, "imperial-quart": 4, "imperial-pint": 8, "imperial-fluid-ounce": 160 },
280
280
  },
281
- "cubic-inch": { abbr: "in³", plural: "cubic inches", to: { milliliter: ML_PER_IN3 } },
282
- "cubic-foot": { abbr: "ft³", plural: "cubic feet", to: { milliliter: IN_PER_FT ** 3 * ML_PER_IN3, "cubic-inch": IN_PER_FT ** 3 } },
281
+ "cubic-inch": { abbr: "in³", many: "cubic inches", to: { milliliter: ML_PER_IN3 } },
282
+ "cubic-foot": { abbr: "ft³", many: "cubic feet", to: { milliliter: IN_PER_FT ** 3 * ML_PER_IN3, "cubic-inch": IN_PER_FT ** 3 } },
283
283
  "cubic-yard": {
284
284
  abbr: "yd³",
285
285
  to: { milliliter: IN_PER_YD ** 3 * ML_PER_IN3, "cubic-foot": FT_PER_YD ** 3, "cubic-inch": IN_PER_YD ** 3 },
@@ -289,10 +289,10 @@ export const VOLUME_UNITS = new UnitList({
289
289
  export const TEMPERATURE_UNITS = new UnitList({
290
290
  celsius: {
291
291
  abbr: "°C",
292
- singular: "degree Celsius",
293
- plural: "degrees Celsius",
292
+ one: "degree Celsius",
293
+ many: "degrees Celsius",
294
294
  to: { fahrenheit: n => n * (9 / 5) + 32, kelvin: n => n + 273.15 },
295
295
  },
296
- fahrenheit: { abbr: "°F", singular: "degree Fahrenheit", plural: "degrees Fahrenheit", to: { celsius: n => (n - 32) * (5 / 9) } },
297
- kelvin: { abbr: "°K", singular: "degree Kelvin", plural: "degrees Kelvin", to: { celsius: n => n - 273.15 } },
296
+ fahrenheit: { abbr: "°F", one: "degree Fahrenheit", many: "degrees Fahrenheit", to: { celsius: n => (n - 32) * (5 / 9) } },
297
+ kelvin: { abbr: "°K", one: "degree Kelvin", many: "degrees Kelvin", to: { celsius: n => n - 273.15 } },
298
298
  });
package/util/url.js CHANGED
@@ -15,7 +15,7 @@ export function getURL(possible, base = _BASE) {
15
15
  try {
16
16
  return isURL(possible) ? possible : new URL(possible, base);
17
17
  }
18
- catch (e) {
18
+ catch (_e) {
19
19
  //
20
20
  }
21
21
  }