Detalhes do pacote

joi-objectid

mkg20001154.8kMIT4.0.2

A MongoDB ObjectId validator for Joi

readme (leia-me)

joi-objectid

A MongoDB ObjectId validator for Joi.

Build Status

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.

const Joi = require('@hapi/joi')
Joi.objectId = require('joi-objectid')(Joi)

const schema = Joi.object({
  id: Joi.objectId(),
  name: Joi.string().max(100),
  date: Joi.date()
})

Installation

npm install joi-objectid --save

Development

running tests

  • npm test

License

MIT

changelog (log de mudanças)

2.0.0 / 2015-08-27

  • breaking; now exports a factory #4

1.1.0 / 2014-12-10

1.0.0 / 2014-09-19

  • birth