@chipdeals/libphonenumber-carriermapper
v1.1.0
Published
Get the carrier of any phone number simply
Downloads
4
Maintainers
Readme
Lib phone number - Carrier Mapper
Simply get the phone carrier, phone details and get possible countries codes attached to a phoneNumber
Installation
npm install @chipdeals/libphonenumber-carriermapper --save
# or
yarn add @chipdeals/libphonenumber-carriermapper
Usage
Get carrier of a phone number
const carrierMapper = require('@chipdeals/libphonenumber-carriermapper');
carrierMapper
.getCarrier("22951010588","BJ")
.then((carrier) => console.log(carrier));
// MTN
Get All details of a phone number
const carrierMapper = require('@chipdeals/libphonenumber-carriermapper');
carrierMapper
.getDetails("22951010588","BJ")
.then((phoneDetails) => console.log(phoneDetails));
/* --- console ---
phoneDetails => {
number: '+229 51 85 85 85', => the phone number you enter in parameter
countryCode: 'BJ', => the country code you enter in parametter
isPossibleNumber: true,
isValidNumber: true,
isValidNumberForRegion: true,
isMobilePhone: true,
isFixedLine: false,
isTollFee: false,
carrier: 'MTN',
location: 'Benin',
phoneNumberRegion: 'BJ',
phonePrefix: '229',
nationalFormat: '51 85 85 85',
internationalFormat: '+229 51 85 85 85'
}
*/
Get possible countries codes
const carrierMapper = require('@chipdeals/libphonenumber-carriermapper');
const countriesCodes = carrierMapper.getPossibleCountriesCodes("+1 671-400-8982");
console.log(countriesCodes)
// [ 'CA', 'GU', 'US' ]
Interfaces
//getCarrier method
(method) CarrierMapper.getCarrier(phoneNumber: string , countryCode: string )
//getDetails method
(method) CarrierMapper.getDetails(phoneNumber: string , countryCode: string )
//getPossibleCountriesCodes method
(method) CarrierMapper.getPossibleCountriesCodes(phoneNumber: string)
You can send two parammeters to both methods.
The first parameter: phoneNumber
is the phone number you want to get info about. It can be a string
or a number
The second parameter is an optionnal couontryCode
. It represent the country code of the phone number
About us
Chipdeals is a technology company solving payments problems for ambitious businesses. Get more about our services
E-mail: [email protected] Website: https://chipdeals.me Phone: +22990630401 Telegram: +22990630401 Whatsapp: +22990630401
Copyright (C) 2022 Chipdeals Inc - https://chipdeals.me