ts-joi-objectid

1.0.2 • Public • Published

joi-objectid

A MongoDB ObjectId validator for Joi with types! Package based on joi-objectid

use

joi-objectid validates that the value is an alphanumeric string of 24 characters in length.

It's used just like you'd use any other Joi type.

import { joiObjectId } from 'ts-joi-objectid';
const joi_oid = joiObjectId(Joi);

let schema: Joi.ObjectSchema = Joi.object({
  id: joi_oid().required(),
  name: Joi.string().max(100),
  date: Joi.date()
})

Installation

npm install joi-objectid --save

Development

npm run dev

License

MIT

/ts-joi-objectid/

    Package Sidebar

    Install

    npm i ts-joi-objectid

    Weekly Downloads

    0

    Version

    1.0.2

    License

    ISC

    Unpacked Size

    18.4 kB

    Total Files

    10

    Last publish

    Collaborators

    • whitenoise1213