joi-fn
Return a function that runs
Joi.attempt
with the given validator
Install
$ npm install --save joi-fn
Usage
var joiFn = var Joi = var validate = // Joi will convert a number-like string to a number for us// => 1 // => throws an error with "custom error" as prefix
API
joiFn(validator, [message])
-> function(value)
vaildator
Required
A Joi validator
message
Type: string|Constructor
Default: ''
A string to prefix Joi's error with, or a custom Error constructor to wrap errors with.
This is passed straight to Joi.attempt().
License
MIT © Andrew Joslin