Skip to content

Latest commit

 

History

History
26 lines (23 loc) · 706 Bytes

README.md

File metadata and controls

26 lines (23 loc) · 706 Bytes

Knesk Joi · GitHub license

Joi Library Extended (https://github.com/hapijs/joi)

How to Install

npm install @knesk/joi
or
yarn add @knesk/joi

Examples

Check example.js for more examples and run by using command node example.js

Usage

const Joi = require('@knesk/joi')
const schema = {
	user: Joi.objectId(), // Mongo Object ID Validation
};
const value = {
	user: '584ebf8bee8d98127efb080c'  
};
const result = Joi.validate(value, schema);
console.log(result.error) // null
console.log(result.value) // { user: 584ebf8bee8d98127efb080c }