From cf70ea90286a6de7c9d4dad2aa33a0b8bec4a9ae Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 3 Jan 2024 20:31:13 -0400 Subject: validators: oneOf -> anyOf --- src/data/things/validators.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/data/things/validators.js') 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`); }; } -- cgit 1.3.0-6-gf8a5