You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
615 B
JavaScript

"use strict";
const either = require("@validatem/either");
// NOTE: This validator should typically come last in an `either`, since it will catch various types of inputs (sqlExpression, literal values, etc.) that might need to be interpreted differently in specific contexts.
// FIXME: Rename valueExpression -> value?
module.exports = function (operations) {
const isValueExpression = require("./is-value-expression")(operations);
const isObjectType = require("./is-object-type")(operations);
return either([
[ isObjectType("anyOfValues") ],
[ isObjectType("allOfValues") ],
isValueExpression
]);
};