Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.
/ extraterrestrial Public archive

Normalising phone numbers (node-phone port)

License

Notifications You must be signed in to change notification settings

dicefm/extraterrestrial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

extra-terrestrial

Normalize mobile phone numbers into a E.164 format.

(E.T. phone home)

Test cases:

import (
	phone "github.com/dicefm/extra-terrestrial"
)
phone.Normalise("+852 6569-8900", "") // return ['+85265698900', 'HKG']
phone.Normalise("(817) 569-8900", "") // return ['+18175698900, 'USA']
phone.Normalise("(817) 569-8900", "") // return ['+18175698900, 'USA']
phone.Normalise("(817) 569-8900", "USA") // return ['+18175698900', 'USA']
phone.Normalise("(817) 569-8900", "HKG") // return ErrNotFound
phone.Normalise("+1(817) 569-8900", "HKG") // return ErrNotFound, as it is not a valid HKG mobile phone number
phone.Normalise("+1(817) 569-8900", "") // return ['+18175698900', 'USA']
phone.Normalise("(817) 569-8900", "") // return ['+18175698900', 'USA']
phone.Normalise("6123-6123", "") // return [], as default country is USA
phone.Normalise("6123-6123", "HKG") // return ['+85261236123', 'HKG']

Note:

This is a port of Node-Phone specifically this version

Dependencies

About

Normalising phone numbers (node-phone port)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages