Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

norm4phone

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

norm4phone

a tool to normalize different writing of phone numbers into standard format

  • 0.1.2
  • PyPI
  • Socket score

Maintainers
1

norm4phone

What is norm4phone?

norm4phone is a python implement of AfterShip/phone

A common problem is that users normally input phone numbers in this way:

`(817) 569-8900` or
`817569-8900` or
`1(817) 569-8900` or
`+1(817) 569-8900` or ...

We always want:

+18175698900

Install

$ pip install norm4phone

Usage

from norm4phone import PhoneNormalizer
pn = PhoneNormalizer(default_country='China')
pn.parse('+8613314672720') //return ['+8613314672720', 'CHN']
pn.parse('+86 13314672720') //return ['+8613314672720', 'CHN']
pn.parse('13314672720') //return['+8613314672720', 'CHN']
pn.parse('86 13314672720') //return ['+8613314672720', 'CHN']
pn.parse('(86) 13314672720') //return ['+8613314672720', 'CHN']
pn.parse('(+86) 13314672720') //return ['+8613314672720', 'CHN']
pn.parse('+(86) 13314672720') //return ['+8613314672720', 'CHN']
pn.parse('+86 133-146-72720') //return ['+8613314672720', 'CHN']
pn.parse('1 6479392750') //return ['+16479392750', 'CAN']

If you want to validate landline phone numbers, set allowLandline to true:

pn.parse('+(852) 2356-4902', '', true)

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc