« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/content/dependencies/generateCoverCarousel.js2
-rw-r--r--src/content/dependencies/generateCoverGrid.js2
-rw-r--r--src/content/dependencies/generateSecondaryNav.js2
-rw-r--r--src/content/dependencies/image.js2
-rw-r--r--src/content/dependencies/linkThing.js4
-rw-r--r--src/data/things/flash.js4
-rw-r--r--src/data/things/homepage-layout.js4
-rw-r--r--src/data/things/validators.js12
-rw-r--r--src/util/external-links.js4
-rw-r--r--src/util/html.js10
-rw-r--r--test/unit/data/things/validators.js8
11 files changed, 27 insertions, 27 deletions
diff --git a/src/content/dependencies/generateCoverCarousel.js b/src/content/dependencies/generateCoverCarousel.js
index 49cb4300..69220da6 100644
--- a/src/content/dependencies/generateCoverCarousel.js
+++ b/src/content/dependencies/generateCoverCarousel.js
@@ -15,7 +15,7 @@ export default {
     images: {validate: v => v.strictArrayOf(v.isHTML)},
     links: {validate: v => v.strictArrayOf(v.isHTML)},
 
-    lazy: {validate: v => v.oneOf(v.isWholeNumber, v.isBoolean)},
+    lazy: {validate: v => v.anyOf(v.isWholeNumber, v.isBoolean)},
     actionLinks: {validate: v => v.sparseArrayOf(v.isHTML)},
   },
 
diff --git a/src/content/dependencies/generateCoverGrid.js b/src/content/dependencies/generateCoverGrid.js
index e2212b70..0433aaf1 100644
--- a/src/content/dependencies/generateCoverGrid.js
+++ b/src/content/dependencies/generateCoverGrid.js
@@ -16,7 +16,7 @@ export default {
     names: {validate: v => v.strictArrayOf(v.isHTML)},
     info: {validate: v => v.strictArrayOf(v.isHTML)},
 
-    lazy: {validate: v => v.oneOf(v.isWholeNumber, v.isBoolean)},
+    lazy: {validate: v => v.anyOf(v.isWholeNumber, v.isBoolean)},
     actionLinks: {validate: v => v.sparseArrayOf(v.isHTML)},
   },
 
diff --git a/src/content/dependencies/generateSecondaryNav.js b/src/content/dependencies/generateSecondaryNav.js
index 1bc0616e..e9aef66e 100644
--- a/src/content/dependencies/generateSecondaryNav.js
+++ b/src/content/dependencies/generateSecondaryNav.js
@@ -8,7 +8,7 @@ export default {
     },
 
     class: {
-      validate: v => v.oneOf(v.isString, v.sparseArrayOf(v.isString)),
+      validate: v => v.anyOf(v.isString, v.sparseArrayOf(v.isString)),
     },
   },
 
diff --git a/src/content/dependencies/image.js b/src/content/dependencies/image.js
index f93ce97e..ab6bccd0 100644
--- a/src/content/dependencies/image.js
+++ b/src/content/dependencies/image.js
@@ -46,7 +46,7 @@ export default {
     thumb: {type: 'string'},
 
     link: {
-      validate: v => v.oneOf(v.isBoolean, v.isString),
+      validate: v => v.anyOf(v.isBoolean, v.isString),
       default: false,
     },
 
diff --git a/src/content/dependencies/linkThing.js b/src/content/dependencies/linkThing.js
index c5998c7e..39710017 100644
--- a/src/content/dependencies/linkThing.js
+++ b/src/content/dependencies/linkThing.js
@@ -36,12 +36,12 @@ export default {
     },
 
     tooltip: {
-      validate: v => v.oneOf(v.isBoolean, v.isHTML),
+      validate: v => v.anyOf(v.isBoolean, v.isHTML),
       default: false,
     },
 
     color: {
-      validate: v => v.oneOf(v.isBoolean, v.isColor),
+      validate: v => v.anyOf(v.isBoolean, v.isColor),
       default: true,
     },
 
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`);
   };
 }
diff --git a/src/util/external-links.js b/src/util/external-links.js
index e95dfef3..0b8b4ab6 100644
--- a/src/util/external-links.js
+++ b/src/util/external-links.js
@@ -1,10 +1,10 @@
 import {empty, stitchArrays} from '#sugar';
 
 import {
+  anyOf,
   is,
   isObject,
   isStringNonEmpty,
-  oneOf,
   optional,
   validateArrayItems,
   validateInstanceOf,
@@ -62,7 +62,7 @@ export const isExternalLinkSpec =
         queries: optional(validateArrayItems(isRegExp)),
 
         context:
-          optional(oneOf(
+          optional(anyOf(
             isExternalLinkContext,
             validateArrayItems(isExternalLinkContext))),
       }),
diff --git a/src/util/html.js b/src/util/html.js
index 9dfd03eb..1a5d1a00 100644
--- a/src/util/html.js
+++ b/src/util/html.js
@@ -7,6 +7,7 @@ import {empty, typeAppearance, unique, withAggregate} from '#sugar';
 import * as commonValidators from '#validators';
 
 const {
+  anyOf,
   is,
   isArray,
   isBoolean,
@@ -14,7 +15,6 @@ const {
   isString,
   isSymbol,
   looseArrayOf,
-  oneOf,
   validateAllPropertyValues,
   validateArrayItems,
   validateInstanceOf,
@@ -1382,7 +1382,7 @@ export const isArrayOfHTML =
   validateArrayItems(value => isHTML(value));
 
 export const isHTML =
-  oneOf(
+  anyOf(
     is(null, undefined, false),
     isString,
     isTag,
@@ -1396,10 +1396,10 @@ export const isHTML =
     isArrayOfHTML);
 
 export const isAttributeKey =
-  oneOf(isString, isSymbol);
+  anyOf(isString, isSymbol);
 
 export const isAttributeValue =
-  oneOf(
+  anyOf(
     isString, isNumber, isBoolean, isArray,
     isTag, isTemplate,
     validateArrayItems(item => isAttributeValue(item)));
@@ -1429,7 +1429,7 @@ export const isAttributesAdditionPair = pair => {
 };
 
 export const isAttributesAdditionSinglet =
-  oneOf(
+  anyOf(
     validateInstanceOf(Template),
     validateInstanceOf(Attributes),
     validateAllPropertyValues(isAttributeValue),
diff --git a/test/unit/data/things/validators.js b/test/unit/data/things/validators.js
index aa56a10e..27d5f4f1 100644
--- a/test/unit/data/things/validators.js
+++ b/test/unit/data/things/validators.js
@@ -30,7 +30,7 @@ import {
   validateReferenceList,
 
   // Compositional utilities
-  oneOf,
+  anyOf,
 } from '#validators';
 
 function test(t, msg, fn) {
@@ -288,10 +288,10 @@ test(t, 'validateReferenceList', t => {
   t.ok(caughtError.errors[1] instanceof TypeError);
 });
 
-test(t, 'oneOf', t => {
+test(t, 'anyOf', t => {
   t.plan(11);
 
-  const isStringOrNumber = oneOf(isString, isNumber);
+  const isStringOrNumber = anyOf(isString, isNumber);
 
   t.ok(isStringOrNumber('hello world'));
   t.ok(isStringOrNumber(42));
@@ -302,7 +302,7 @@ test(t, 'oneOf', t => {
     throw mockError;
   };
 
-  const isStringOrGetRekt = oneOf(isString, neverSucceeds);
+  const isStringOrGetRekt = anyOf(isString, neverSucceeds);
 
   t.ok(isStringOrGetRekt('phew!'));