🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

number_info

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

number_info

Useful tools to translate telephone numbers to and from E164

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

License npm version js-standard-style

Build Status Coverage Status Code Climate Issue Count

number_info

This library is used to resolve a dialed phone number, returning country information along with area codes, phone type, etc. It uses the NodeJS port of the Google's libphonenumber.

Installing

Add this library to your package.json configuration:

  "dependencies": {
    "number_info": "latest"
  }

Using it

  var number_info = require('number_info');
  var result = number_info.resolve(dialedString, numberingPlan);

numberingPlan is optional. When not supplied, it will be assumed that dialedString is an E164 number without the leading +.

If supplied, it must be a 2-letter ISO country code that will be used to translate this number from a local dialed number into an E164 number. In essence, the country specifices the numbering plan used to interpret the dialed number.

For example, from the US you will dial 011+number to reach an international destination, while other countries will have different ways for dialing local, long distance, and international destinations (e.g: 00+number).

Examples

Below you will find a few examples for the most common usage. More examples can be found in the tests.

Resolving an E164 number

  var result = number_info.resolve('18009997777');

Resolving a number using the US numbering plan

  var result = number_info.resolve('005491145556666');

Developers

This project uses standard npm scripts. Current tasks include:

  • test: Runs Mocha tests.
  • jsdoc: Runs JSDoc3.
  • eslint: Runs ESLint.
  • coverage: Runs the tests and then Instanbul to get a coverage report.
  • build: This is the default task, and will run all the other tasks.

Running an npm task

To run a task, just do:

npm run build

Contributing

To contribute:

  • Make sure you open a concise and short pull request.
  • Throw in any needed unit tests to accomodate the new code or the changes involved.
  • Run npm run build and make sure everything is ok before submitting the pull request (make eslint happy).
  • Your code must comply with the Javascript Standard Style, ESLint should take care of that.

License

The source code is released under Apache 2 License.

Check LICENSE file for more information.

Keywords

voip

FAQs

Package last updated on 10 Feb 2017

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