1.0.4 • Published 10 years ago

objoi v1.0.4

Weekly downloads
2
License
ISC
Repository
github
Last release
10 years ago

objoi

Build Status Coverage Status Dependencies

Using ES2015's new Proxy object and the power of joi, validate input to native JS objects, arrays and functions.

// Load dem modules
var objoi = require('objoi')
var joi = objoi.joi

// Make `foo` an object with a schema
var foo = objoi({}, joi.object().keys({
    bar: joi.boolean()
}))

// Throws error: "bar" must be a boolean
foo.bar = 'baz'

// Lets it happen
foo.bar = 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.

I want a slowly-typed, animated example

asciicast

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago