Socket
Socket
Sign inDemoInstall

phones

Package Overview
Dependencies
3
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.0 to 1.0.0

index.js

41

package.json
{
"name": "phones",
"version": "0.1.0",
"description": "JS library for parsing and formatting phone numbers",
"main": "./src",
"main": "index.js",
"version": "1.0.0",
"description": "Parse, format, and validate US phone numbers",
"license": "MIT",
"repository": "bendrucker/phones",
"author": {
"name": "Ben Drucker",
"email": "bvdrucker@gmail.com",
"url": "bendrucker.me"
},
"scripts": {
"test": "istanbul cover node_modules/.bin/_mocha -- ./test"
"test": "standard && tape test.js"
},
"repository": {
"type": "git",
"url": "https://github.com/bendrucker/phones.git"
},
"keywords": [
"phone",
"number",
"international"
"phones",
"us",
"american"
],
"author": "Ben Drucker <bvdrucker@gmail.com> (http://www.bendrucker.me/)",
"license": "MIT",
"bugs": {
"url": "https://github.com/bendrucker/phones/issues"
"devDependencies": {
"tape": "^4.0.0",
"standard": "^4.0.0"
},
"homepage": "https://github.com/bendrucker/phones",
"devDependencies": {
"chai": "^1.9.2",
"istanbul": "~0.3.2",
"mocha": "^2.0.1"
"files": [
"index.js"
],
"dependencies": {
"separate": "~1.0.0"
}
}

@@ -1,4 +0,66 @@

phones
======
# phones [![Build Status](https://travis-ci.org/bendrucker/phones.svg?branch=master)](https://travis-ci.org/bendrucker/phones)
JS library for parsing and formatting phone numbers
> Parse, format, and validate US phone numbers
## Install
```
$ npm install --save phones
```
## Usage
```js
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.
##### 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](http://bendrucker.me)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc