Input it into the mapper this package provides to get it.
Use it as you would Google's libphonenumber's PhoneNumberToCarrierMapper in Java
Is a TypeScript rendition of PhoneNumberToCarrierMapper because the JavaScript version of libphonenumber on NPM didn't have a PhoneNumberToCarrierMapper
Batteries included. Mobile carrier names are read from included binary-encoded files.
Has no error handling (we read from files). Be sure to try-catch your async functions and .catch your promises.
Depends upon NPM package libphonenumber-js
Quick Start / API
// Example 1: ESM and await syntaximportPhoneNumberToCarrierMapperfrom'phone-carrier';asyncfunctionlookup(msisdn){constmapper=PhoneNumberToCarrierMapper.getInstance();constcarrierName=awaitmapper.getNameForValidNumber(msisdn);returncarrierName;}console.log(lookup(`+41798765432`));// Swisscom
// Example 2: CommonJS and promise syntaxconst{ PhoneNumberToCarrierMapper }=require('phone-carrier')constmapper=PhoneNumberToCarrierMapper.getInstance()mapper.getNameForValidNumber(`+917897888888`).then(console.log)// AirTel