Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.
/ objoi Public archive

Validate native object input using JOI.

Notifications You must be signed in to change notification settings

jpwilliams/objoi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Validate native object input using JOI.

Resources

Stars

Watchers

Forks

Packages

No packages published