diff options
Diffstat (limited to 'src/data')
-rw-r--r-- | src/data/things/flash.js | 4 | ||||
-rw-r--r-- | src/data/things/homepage-layout.js | 4 | ||||
-rw-r--r-- | src/data/things/validators.js | 12 |
3 files changed, 10 insertions, 10 deletions
diff --git a/src/data/things/flash.js b/src/data/things/flash.js index 1bdda6c8..997f526e 100644 --- a/src/data/things/flash.js +++ b/src/data/things/flash.js @@ -2,11 +2,11 @@ import {input} from '#composite'; import find from '#find'; import { + anyOf, isColor, isDirectory, isNumber, isString, - oneOf, } from '#validators'; import {exposeDependency, exposeUpdateValueOrContinue} @@ -57,7 +57,7 @@ export class Flash extends Thing { page: { flags: {update: true, expose: true}, - update: {validate: oneOf(isString, isNumber)}, + update: {validate: anyOf(isString, isNumber)}, expose: { transform: (value) => (value === null ? null : value.toString()), diff --git a/src/data/things/homepage-layout.js b/src/data/things/homepage-layout.js index 59c069bd..e390da19 100644 --- a/src/data/things/homepage-layout.js +++ b/src/data/things/homepage-layout.js @@ -2,11 +2,11 @@ import {input} from '#composite'; import find from '#find'; import { + anyOf, is, isCountingNumber, isString, isStringNonEmpty, - oneOf, validateArrayItems, validateInstanceOf, validateReference, @@ -124,7 +124,7 @@ export class HomepageLayoutAlbumsRow extends HomepageLayoutRow { update: { validate: - oneOf( + anyOf( is('new-releases', 'new-additions'), validateReference(Group[Thing.referenceType])), }, diff --git a/src/data/things/validators.js b/src/data/things/validators.js index 2058fb91..866a9dad 100644 --- a/src/data/things/validators.js +++ b/src/data/things/validators.js @@ -625,7 +625,7 @@ export const isAdditionalName = validateProperties({ // Double TODO: Explicitly allowing both references and // live objects to co-exist is definitely weird, and // altogether questions the way we define validators... - optional(oneOf( + optional(anyOf( validateReferenceList('track'), validateWikiData({referenceType: 'track'}))), }); @@ -634,7 +634,7 @@ export const isAdditionalNameList = validateArrayItems(isAdditionalName); // Compositional utilities -export function oneOf(...validators) { +export function anyOf(...validators) { const validConstants = new Set(); const validConstructors = new Set(); const validTypes = new Set(); @@ -724,7 +724,7 @@ export function oneOf(...validators) { constantValidators, offset++, new TypeError( - `Expected one of ${constants.join(' ')}` + gotPart), + `Expected any of ${constants.join(' ')}` + gotPart), ]); } @@ -739,7 +739,7 @@ export function oneOf(...validators) { typeValidators, offset++, new TypeError( - `Expected one of ${types.join(', ')}` + gotPart), + `Expected any of ${types.join(', ')}` + gotPart), ]); } @@ -755,7 +755,7 @@ export function oneOf(...validators) { constructorValidators, offset++, new TypeError( - `Expected one of ${names.join(', ')}` + gotPart), + `Expected any of ${names.join(', ')}` + gotPart), ]); } @@ -779,7 +779,7 @@ export function oneOf(...validators) { const total = offset + leftoverValidators.length; throw new AggregateError(errors, - `Expected one of ${total} possible checks, ` + + `Expected any of ${total} possible checks, ` + `but none were true`); }; } |