"use strict"; const ValidationError = require("@validatem/error"); const isString = require("@validatem/is-string"); module.exports = [ isString, function isLowercase(value) { // By applying a case transformation and then comparing, instead of eg. using a regular expression, we outsource the decision of "what counts as lowercase" to the JS runtime (which means we don't need to worry about things like non-obvious cases in non-English writing systems) if (value.toLowerCase() !== value) { throw new ValidationError(`Must be all-lowercase`); } } ];