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