Skip to content

Validate and format phone number, or return nothing, if such phone is not valid.

Notifications You must be signed in to change notification settings

titarenko/fix-phone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fix-phone

Build Status Coverage Status

Validate and format phone number, or return nothing, if such phone is not valid.

Installation

npm i fix-phone --save

Usage

var fix = require('fix-phone');

fix('ua', '050-121-22-33'); // returns +380501212233
fix('ua', '010-121-22-33'); // returns null

fix.decompose('ua', '050-121-22-33'); // returns { country: '+380', local: '50', phone: '1212233' }
fix.decompose('ua', '010-121-22-33'); // returns null

Supported country codes

Take look at country modules directory.

Contributors

License

MIT

About

Validate and format phone number, or return nothing, if such phone is not valid.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published