"use strict"; const ValidationError = require("@validatem/error"); // FIXME: Note in README that this module DOES NOT enforce any particular type, due to `.length` being a de facto standard of sorts module.exports = function createHasLengthOfValidator(expectedLength) { return function hasLengthOf(value) { if (value.length == null || value.length !== expectedLength) { throw new ValidationError(`Must have a length of exactly ${expectedLength}; actual length was ${value.length}`); } } };