1.0.0 • Published 6 years ago

joi-starts-with-ref v1.0.0

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

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()
});