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.

15 lines
395 B
JavaScript

"use strict";
const errors = require("../errors");
const getValueType = require("../util/get-value-type");
module.exports = function createBooleanValidatorFunction(_options = {}) {
return function validateBoolean(value) {
if (typeof value !== "boolean") {
return new errors.ValidationError(`Expected a boolean, got ${getValueType(value)} instead`);
} else {
return true;
}
};
};