Created
April 8, 2016 20:06
-
-
Save mrlannigan/59237d5b7f1cdeb002da24f00c97ddb5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////////////////////////////////// | |
// mapping example | |
var x = { | |
validate: { | |
type: 'joi', | |
key: 'somekey' | |
} | |
} | |
// sidebar: the mapping example | |
mapping.somekey = Joi.object().keys({ | |
a: Joi.string().length(5) | |
}) | |
//end sidebar | |
z = mapping[x.validate.key]; | |
////////////////////////////////////////////////// | |
// custom compile example | |
var y = { | |
validate: { | |
type: 'joi', | |
schema: { | |
pie: /^.+/ | |
} | |
} | |
} | |
z = Joi.compile(y.validate.schema); | |
////////////////////////////////////////////////// | |
// both cases do this | |
z.validate({pie: 'test'}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment