shelving 1.159.1 → 1.159.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
package/schema/ArraySchema.js
CHANGED
|
@@ -51,9 +51,9 @@ export class ArraySchema extends Schema {
|
|
|
51
51
|
const validArray = validateArray(unsafeValue, this.items);
|
|
52
52
|
const uniqueArray = this.unique ? getUniqueArray(validArray) : validArray;
|
|
53
53
|
if (uniqueArray.length < this.min)
|
|
54
|
-
throw new ValueFeedback(uniqueArray.length ? `Minimum ${this.min}
|
|
54
|
+
throw new ValueFeedback(uniqueArray.length ? `Minimum ${this.min} ${this.many}` : "Required", uniqueArray);
|
|
55
55
|
if (uniqueArray.length > this.max)
|
|
56
|
-
throw new ValueFeedback(`Maximum ${this.max}
|
|
56
|
+
throw new ValueFeedback(`Maximum ${this.max} ${this.many}`, uniqueArray);
|
|
57
57
|
return uniqueArray;
|
|
58
58
|
}
|
|
59
59
|
}
|
package/schema/ChoiceSchema.d.ts
CHANGED
|
@@ -14,9 +14,9 @@ export declare function isOption<K extends string>(options: ChoiceOptions<K>, op
|
|
|
14
14
|
/** Allowed options for `ChoiceSchema` */
|
|
15
15
|
export interface ChoiceSchemaOptions<K extends string> extends Omit<SchemaOptions, "value"> {
|
|
16
16
|
/** Specify correct options using a dictionary of entries. */
|
|
17
|
-
options: ChoiceOptions<K>;
|
|
17
|
+
readonly options: ChoiceOptions<K>;
|
|
18
18
|
/** Default option for the value. */
|
|
19
|
-
value?: K;
|
|
19
|
+
readonly value?: K;
|
|
20
20
|
}
|
|
21
21
|
/** Choose from an allowed set of values. */
|
|
22
22
|
export declare class ChoiceSchema<K extends string> extends Schema<K> implements Iterable<ChoiceOption<K>> {
|
|
@@ -23,9 +23,9 @@ export class DictionarySchema extends Schema {
|
|
|
23
23
|
const validDictionary = validateDictionary(unsafeValue, this.items);
|
|
24
24
|
const length = Object.keys(validDictionary).length;
|
|
25
25
|
if (length < this.min)
|
|
26
|
-
throw new ValueFeedback(length ? `Minimum ${this.min}
|
|
26
|
+
throw new ValueFeedback(length ? `Minimum ${this.min} ${this.many}` : "Required", validDictionary);
|
|
27
27
|
if (length > this.max)
|
|
28
|
-
throw new ValueFeedback(`Maximum ${this.max}
|
|
28
|
+
throw new ValueFeedback(`Maximum ${this.max} ${this.many}`, validDictionary);
|
|
29
29
|
return validDictionary;
|
|
30
30
|
}
|
|
31
31
|
}
|