joi-verhoeff
Provides a Joi rule to validate strings as sequences of numerals with a valid verhoeff checksum digit.
Strings are validated as being entirely composed of digits, and containing a valid checksum using node-verhoeff.
Usage
;; const Joi = BaseJoi; // Create a joi schema using the Verhoeff validator;const schema = Joi;
Results with valid checksum:
Joi;/* { error: null, value: '3789125' } */
Results with invalid checksum:
Joi;/*{ error: { [ValidationError: "value" checksum failure] isJoi: true, name: 'ValidationError', details: [{ message: '"value" checksum failure', path: 'value', type: 'string.verhoeff', context: { v: '3789122', key: 'value' } }], ... }, value: '3789122'} */