Exciting news!Announcing our $4.6M Series Seed. Learn more
Socket
LoveBlogFAQ
Install
Log in

phones

Package Overview
Dependencies
1
Maintainers
1
Versions
5
Issues
File Explorer

Advanced tools

phones

Parse, format, and validate US phone numbers

    2.0.1latest

Version published
Maintainers
1
Yearly downloads
16,899
decreased by-36.26%

Weekly downloads

Readme

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

What is phones?

Parse, format, and validate US phone numbers

Is phones popular?

The npm package phones receives a total of 202 weekly downloads. As such, phones popularity was classified as not popular.

Is phones well maintained?

We found that phones demonstrated a not healthy version release cadence and project activity. It has 1 open source maintainer collaborating on the project.

Last updated on 24 Sep 2015
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc