joi-extension-msisdn
v1.0.1
Published
Joi extension to normalize russian msisdns
Downloads
4
Readme
joi-extension-msisdn
Joi extension to validate russian msisdns.
Install
$ npm install joi-extension-msisdn --save
Usage
Extension has only valid
rule for msisdn
.
import Joi from 'joi';
import JoiMsisdnExt from 'joi-extension-msisdn';
Joi.attempt('9060523777', Joi.extend(JoiMsisdnExt).msisdn().valid());
You can also use it with HapiJS as a route validator:
import Joi from 'joi';
import JoiMsisdnExt from 'joi-extension-msisdn';
// ...
export default [
{
method: 'GET',
path: '/info',
handler: info,
config: {
validate: {
query: Joi.object({
msisdn: Joi.extend(JoiMsisdnExt).msisdn().valid()
})
},
description: 'Do something that requires valid msisdn',
tags: ['api']
}
}
];
// ...