Socket
Socket
Sign inDemoInstall

phones

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

phones

Parse, format, and validate US phone numbers


Version published
Weekly downloads
54
decreased by-61.15%
Maintainers
1
Weekly downloads
 
Created
Source

phones Build Status

Parse, format, and validate US phone numbers

Install

$ npm install --save phones

Usage

var phones = require('phones')

phones.parse('415-555-1234')
//=> 4155551234

phones.format('4155551234')
//=> 415 555 1234

phones.validate('4155551234')
//=> true

API

phones.parse(phone) -> string
phone

Required
Type: string

A phone number to parse. A leading 1 country code will be stripped.

phones.format(phone, [separator]) -> string

Format a 10 digit phone string by adding separators and truncating extra digits.

phone

Required
Type: string

A phone number to format. Digits only.

separator

Type: string
Default: ' '

phones.validate(phone) -> boolean
phone

Required
Type: string

A phone number to validate as a 10 digit string.

License

MIT © Ben Drucker

Keywords

FAQs

Package last updated on 17 Sep 2015

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