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
380 B
JavaScript

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