1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 1× 1× 1× 45× 45× 45× 73× 51× | import messages from './messages' import Validators from './index' import { toObjectMsg, prepare, memoize } from './helpers' let format = memoize(function ({ 'with': wit, without, message, msg, 'if': ifCond, unless, allowBlank }) { msg = toObjectMsg(msg || message) return prepare(ifCond, unless, allowBlank, function (value) { if ((wit && !value.match(wit)) || (without && value.match(without))) { return Validators.formatMessage(msg || messages.invalid) } }) }) export default format |