November: Procrastination Month

    libphonenumber-umd

    1.0.1 • Public • Published

    libphonenumber-umd

    Google's libphonenumber packaged as UMD exposing the i18n namespace

    See https://github.com/googlei18n/libphonenumber

    Usage

    NodeJS module

    var libphonenumber = require('libphonenumber-umd');

    or AMD

    require(['libphonenumber-umd'], function (libphonenumber) {
      ...

    or

    <script src="libphonenumber-umd/libphonenumber"></script>
    <script>
      var libphonenumber = window.i18n;
      ...

    ex:

    function format (number) {
      var phoneUtil = libphonenumber.phonenumbers.PhoneNumberUtil.getInstance();
      number = phoneUtil.parseAndKeepRawInput(number, 'DE');
      return phoneUtil.format(number, libphonenumber.phonenumbers.PhoneNumberFormat.E164);
    };
     
    format('030 555-555'); // +4930555555

    Install

    npm i libphonenumber-umd

    DownloadsWeekly Downloads

    10

    Version

    1.0.1

    License

    none

    Last publish

    Collaborators

    • xmartin