shelving 1.187.1 → 1.187.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shelving",
3
- "version": "1.187.1",
3
+ "version": "1.187.2",
4
4
  "author": "Dave Houlbrooke <dave@shax.com>",
5
5
  "repository": {
6
6
  "type": "git",
@@ -13,10 +13,6 @@ export type ChoiceOptions<K extends string> = {
13
13
  * - Array of string options in `[key]` format (`key` will be used as the `title` too).
14
14
  */
15
15
  export type PossibleChoiceOptions<K extends string> = ImmutableArray<K> | ChoiceOptions<K>;
16
- /** A single tuple for a choice option in `[key, title]` format. */
17
- export type ChoiceOption<K extends string> = readonly [title: K, title: string];
18
- /** Get a `ChoiceOptions` object for a set of `PossibleChoiceOptions`. */
19
- export declare function getChoiceOptions<K extends string>(options: PossibleChoiceOptions<K>): ChoiceOptions<K>;
20
16
  /** Allowed options for `ChoiceSchema` */
21
17
  export interface ChoiceSchemaOptions<K extends string> extends Omit<SchemaOptions, "value"> {
22
18
  /** Specify correct options using a dictionary of entries. */
@@ -33,4 +29,4 @@ export declare class ChoiceSchema<K extends string> extends Schema<K> {
33
29
  format(value: K): string;
34
30
  }
35
31
  /** Choose from an allowed set of values. */
36
- export declare function CHOICE<K extends string>(options: PossibleChoiceOptions<K> | ImmutableArray<K>): ChoiceSchema<K>;
32
+ export declare function CHOICE<K extends string>(options: PossibleChoiceOptions<K>): ChoiceSchema<K>;
@@ -2,7 +2,7 @@ import { isArray } from "../util/array.js";
2
2
  import { isProp } from "../util/object.js";
3
3
  import { Schema } from "./Schema.js";
4
4
  /** Get a `ChoiceOptions` object for a set of `PossibleChoiceOptions`. */
5
- export function getChoiceOptions(options) {
5
+ function _getChoiceOptions(options) {
6
6
  return isArray(options) ? Object.fromEntries(options.map(_getChoiceOption)) : options;
7
7
  }
8
8
  function _getChoiceOption(k) {
@@ -13,7 +13,7 @@ export class ChoiceSchema extends Schema {
13
13
  options;
14
14
  constructor({ one = "choice", title = "Choice", placeholder = `No ${one}`, options, value, ...rest }) {
15
15
  super({ one, title, value, placeholder, ...rest });
16
- this.options = getChoiceOptions(options);
16
+ this.options = _getChoiceOptions(options);
17
17
  }
18
18
  validate(unsafeValue = this.value) {
19
19
  if (typeof unsafeValue === "string" && isProp(this.options, unsafeValue))