Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jxm262/joibird
Joi + Bluebird = A Promise based library for Joi
https://github.com/jxm262/joibird
Last synced: 19 days ago
JSON representation
Joi + Bluebird = A Promise based library for Joi
- Host: GitHub
- URL: https://github.com/jxm262/joibird
- Owner: jxm262
- Created: 2015-04-09T01:16:23.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-04-10T19:22:29.000Z (over 9 years ago)
- Last Synced: 2023-08-21T11:26:07.653Z (about 1 year ago)
- Language: JavaScript
- Size: 117 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# joibird [![Build Status](https://travis-ci.org/jxm262/joibird.svg?branch=master)](https://travis-ci.org/jxm262/joibird)
Joi + Bluebird = A Promise based library for Joi
Joibird converts the `validate` function of Joi to make it Asynchronous
## Download
npm install joibird
#### Example
```js
var joibird = require('../lib/joibird');var schema = joibird.object().keys({
username: joibird.string().alphanum().min(3).max(30).required(),
password: joibird.string().regex(/[a-zA-Z0-9]{3,30}/),
access_token: [joibird.string(), joibird.number()],
birthyear: joibird.number().integer().min(1900).max(2013),
email: joibird.string().email()
}).with('username', 'birthyear').without('password', 'access_token');
joibird
.validate({ username: 'abc', birthyear: 1994 }, schema)
.then(function(done) {
console.log(done);
})
.catch(function(err) {
console.log(err);
});
```