joi-starts-with-ref
v1.0.0
Published
Joi custom validator to check if something starts with value of a joi ref
Downloads
4
Readme
joi-starts-with-ref
Joi custom validator to allow validating a field by checking it starts with the value of another field.
Install
npm i joi-starts-with-ref -S
Usage
See the tests for more examples
const Joi = require("joi");
const joiStartsWith = require("joi-starts-with-ref");
module.exports = Joi.object().keys({
"firstName": Joi.string(),
"fullName": joiStartsWith.string().startsWithRef("firstName").required()
});