Giter Club home page Giter Club logo

node-phone-utils's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

gladiopeace

node-phone-utils's Issues

The module require a .env file

The module require a .env file to use it for hlr-lookup, but even if it's not an hlr-lookup the module still require the .env file, I've tried to add an empty .env, and it worked.

Update the README.md file

  • Update this line var phoneNumberUtils = require('phone-number-utils').createInstance(); to var phoneNumberUtils = require('node-phone-utils').createInstance();
  • Add section about .env file to add

Simplify the logger facade

The logger facade is clean but a bit complex.

Maybe a simpler facade would be cleaner, e.g

var winston;
try {
    winston = require('winston');
}
catch(e) {}

if (!process.env.DEBUG) {
  global.Logger = {
    log: function() {},
    info: function() {},
    error: function() {},
    warn: function() {},
  };
} else if (winston) {
  global.Logger = winston;
} else {
  global.Logger = console;
}

Add getRegionCode

Like we hava getCountryCode we need getRegionCode for a phone number

Validator declines e164 format number

Error: Number: +5548996607945 is not considered a valid e164 formatted phone number.
    at /Users/macbook/Programming/JS/service-phone-number/node_modules/node-phone-utils/lib/providers/hlr-lookups-provider.js:54:21
    at new Promise (<anonymous>)
    at HLRLookupsProvider.hlrLookup (/Users/macbook/Programming/JS/service-phone-number/node_modules/node-phone-utils/lib/providers/hlr-lookups-provider.js:49:10)

Split initialization of sms provider and hlr lookups provider

I needed only HLR lookups provider, so I called getProviders() function to get one, but the thing is that it also initializes SmsApiProvider inside and hence requires some envs to configure that one.

So I needed to use random values as stubs to avoid assertion error when it tried to initialize SmsApiProvider, but this polluted the env file with some unused stubs.

I think providers should be initialized separately and the function should be split in two

UPD: for backward compatibility you can keep getProviders function that will call those 2 new functions after a separation of concerns

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.