shelving 1.152.2 → 1.152.3

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/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "state-management",
12
12
  "query-builder"
13
13
  ],
14
- "version": "1.152.2",
14
+ "version": "1.152.3",
15
15
  "repository": "https://github.com/dhoulb/shelving",
16
16
  "author": "Dave Houlbrooke <dave@shax.com>",
17
17
  "license": "0BSD",
package/util/units.d.ts CHANGED
@@ -16,7 +16,7 @@ type UnitProps<T extends 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). */
19
- readonly options?: Intl.NumberFormatOptions;
19
+ readonly options?: Readonly<Intl.NumberFormatOptions> | undefined;
20
20
  };
21
21
  /** Represent a unit. */
22
22
  export declare class Unit<K extends string> {
@@ -32,7 +32,7 @@ export declare class Unit<K extends string> {
32
32
  /** Plural name for this unit, e.g. `kilometers` (defaults to `singular` + "s"). */
33
33
  readonly plural: 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
- readonly options?: Readonly<Intl.NumberFormatOptions>;
35
+ readonly options: Readonly<Intl.NumberFormatOptions> | undefined;
36
36
  /** Title for this unit (uses format `abbr (plural)`, e.g. `fl oz (US fluid ounces)`) */
37
37
  get title(): string;
38
38
  constructor(
@@ -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, to }: UnitProps<K>);
44
+ { abbr, singular, plural, 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
@@ -33,12 +33,13 @@ 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`, to }) {
36
+ { abbr = key.slice(0, 1), singular = key.replace(/-/, " "), plural = `${singular}s`, options, to }) {
37
37
  this.list = list;
38
38
  this.key = key;
39
39
  this.abbr = abbr;
40
40
  this.singular = singular;
41
41
  this.plural = plural;
42
+ this.options = options;
42
43
  this._to = to;
43
44
  }
44
45
  /** Convert an amount from this unit to another unit. */