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

phonecc

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

phonecc

A tiny helped to split phone numbers into country codes and phone numbers

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

phonecc

A tiny helper to split phone numbers into country codes and phone numbers

Motivation

Dealing with phone numbers is a pain. And yet its something we deal with on a near daily basis. We created this project to help all those unfortunate folk who have to deal with the tedium of getting country codes and playing with them in phone numbers. Its mostly a WIP but we are trying our best to find time to regularly update and improve the module.

Installation

To install the library use

$ npm i phonecc --save

To install the library and save it as a dependency in package.json use

$ npm i phonecc --save

To install the library globally use

$ npm i -g phonecc

Usage

var phonecc = require('phonecc')

// Usage with callbacks
phonecc.split(phone, (error, result) => {
    if (error) {
        //TODO: Handle errors here
        return;
    } else {
        //TODO: Handle the successful split of numbers
        //Also handle blank cc returns incase no country
        //code existed in the number
        console.log(result);
    }
});

// Usage with return value
var result = phonecc.splitSync(phone)
if (result) {
  // Result contains an object of structure {cc: string, phone: string}
  console.log(result)
} else {
  console.log('error processing phone number')
}

Credits

Hanut Singh Gusain Juggernaut451

Keywords

FAQs

Package last updated on 25 Sep 2018

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