1.0.2 • Published 5 years ago

@ciruxx/joi-extension-objectid v1.0.2

Weekly downloads
6
License
Apache-2.0
Repository
github
Last release
5 years ago

joi-extension-objectid

version license

ObjectId extension for the Joi validation library

Usage

const JoiExtensionObjectId = require('@ciruxx/joi-extension-objectid');
const Joi = require('joi').extend(JoiExtensionObjectId);

const schema = Joi.object({
    objectIdKey: Joi.objectId()
});

const validatedData = await schema.validateAsync({
    objectIdKey: "5fd777d57fcb54c356763034"
})

data.objectIdKey instanceof ObjectID // true!

offrex