Skip to content

validates that the value is a valid international phone number complying to E.164 numbering format

License

Notifications You must be signed in to change notification settings

keepitsimple/joi-phone

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
Roman Podlinov
Aug 26, 2015
7ddc357 · Aug 26, 2015

History

11 Commits
Dec 17, 2014
Dec 17, 2014
Jan 5, 2015
Dec 17, 2014
Jan 5, 2015
Aug 26, 2015
Dec 17, 2014
Jan 5, 2015

Repository files navigation

joi-phone

A phone validator for Joi.

joi-phone validates that a value is a valid international phone number complying to E.164 numbering format

build status

Introduction

An international E.164 number is designed to include all of the necessary information to successfully route a call to an individual subscriber on a nation's public telephone network. Here's how the E.164 numbering plan works:

  • A telephone number can have a maximum of 15 digits
  • The first part of the telephone number is the country code (one to three digits)
  • The second part is the national destination code (NDC)
  • The last part is the subscriber number (SN)
  • The NDC and SN together are collectively called the national (significant) number
[+][country code][subscriber number including area code or national (significant) number]

Use

var Joi = require('joi');
Joi.phone = require('joi-phone');

var schema = {
  phone: Joi.phone.e164()
}

Installation

npm install joi-phone --save

Tests

npm test

License

MIT

About

validates that the value is a valid international phone number complying to E.164 numbering format

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%