@wegolook/joi-objectid
v6.1.1
Published
Extends Joi with Joi.objectId()
Downloads
162
Readme
@wegolook/joi-objectid
Joi extension to support BSON ObjectId
Usage
// import and assignment
const Joi = require('joi'); // use version ^9.0.0
const joiObjectId = require('@wegolook/joi-objectid');
const myJoi = Joi.extend(joiObjectId);
// ...then
const result = myJoi.objectId().validate(myObjectId);
// result.value, result.errors, etc...
// ...or
myJoi.objectId().validate(myObjectId, (err, value) => { /*...*/ });