joi-international-phone
v1.0.1
Published
Allows you to do joi.internationalPhone()
Downloads
10
Readme
What
Allows you to do joi.internationalPhone()
Uses https://github.com/ruimarinho/google-libphonenumber for validation.
Which is a compiled version of the Google library https://github.com/googlei18n/libphonenumber.
How
const joi = require('joi')
.extend(require('joi-international-phone'));
const schema = joi.object({
phone: joi.internationalPhone()
});
schema.validate('+ 55 55 99730 0000');
// {
// value: '+55 55 99730-0000',
// error: null
// }
schema.validate('not a phone');
// {
// value: 'not a phone',
// error: 'The string supplied did not seem to be a phone number'
// }