objoi
Using ES2015's new Proxy
object and the power of joi, validate input to native JS objects, arrays and functions.
// Load dem modulesvar objoi =var joi = objoijoi// Make `foo` an object with a schemavar foo =// Throws error: "bar" must be a booleanfoobar = 'baz'// Lets it happenfoobar = true
Why did you do this?
I don't know yet. I mean, it's gotta be useful for something, right?
Anything else?
objoi
also exposes objoi.joi
which you can use to create schemas with in case you don't want to add two dependencies for a single module.