2.0.0 • Published 6 years ago

phonecc v2.0.0

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

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

2.0.0

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago