Git Product home page Git Product logo

phoneformat.js's Introduction

PhoneFormat.js

A javascript phone formatter

Install

via Bower

bower install phoneformat.js

via NPM

npm install phoneformat.js

All files for usage are in the /dist directory.

  • Amd:
    • phone-format-amd.js or phone-format-amd.min.js
  • Exports:
    • phone-format-exports.js or phone-format-amd.min.js
  • Global:
    • phone-format-global.js or phone-format-global.min.js
  • Original Blend:
    • phone-format.js or phone-format.min.js

API

Function Parameters Example
countryForE164Number phoneNumber : string phoneFormat.countryForE164Number(validInternationalPhoneNumber);
formatNumberForMobileDialing countryCode : string, phoneNumber : string phoneFormat.formatNumberForMobileDialing(countryCode, validPhoneNumber);
isValidNumber phoneNumber : string, countryCode : string phoneFormat.isValidNumber(validPhoneNumber, countryCode);
formatE164 countryCode: string, phoneNumber : string phoneFormat.formatE164(countryCode, validPhoneNumber);
formatInternational countryCode : string, phoneNumber : string phoneFormat.formatInternational(countryCode, validPhoneNumber);
formatLocal countryCode : string, phoneNumber : string phoneFormat.formatLocal(countryCode, validPhoneNumber);
exampleLandlineNumber countryCode : string phoneFormat.exampleLandlineNumber(countryCode);
exampleMobileNumber countryCode : string phoneFormat.exampleMobileNumber(countryCode);
cleanPhone phoneNumber : string phoneFormat.cleanPhone(validPhoneNumber);
countryCodeToName countryCode : string phoneFormat.countryCodeToName(countryCode);

FAQ

Is PhoneFormat.js in sync with the latest libphonenumber?

More often then not PhoneFormat.js will NOT be using the latest version of libphonenumber.

It was last synced v8.10.6

If this is causing you any headaches, please follow the instructions below to update the source files in /lib.

  • Step 1

    • Copy to your clipboard, the contents of closure.txt at the top of this page
  • Step 2

  • Step 3

    • Paste the contents of closure.txt into the big textarea on the left side of the screen under the Compile button.
    • Make sure you delete whatever text is already the textarea!
    • After you've pasted it press the Compile button
    • If everything works correctly, on the right side of the screen will be a freshly compiled google-libraries.js
  • Step 4

    • Update lib/google-libraries.js with the compiled libraries from the compiler service.
    • Run npm run build
    • Commit your change, push it up and submit a pull request.
    • Thank you!

Questions?

This project was created by @albeebe.

phoneformat.js's People

Contributors

sturdynut avatar albeebe avatar andidev avatar jordaaash avatar igloczek avatar clockwerx avatar mwilk21 avatar dolfelt avatar marcdelalonde avatar theblang avatar nicudine avatar pbechu avatar thiagolimaaurea avatar tylergraf avatar kmuenze avatar ra00l avatar

Stargazers

Michael Barley avatar Jamie Sparks avatar Travis Vander Hoop avatar Dustin Metcalf avatar  avatar Eric Minor avatar Chris Xue avatar Chen Ming avatar  avatar Julio Lopez avatar Cort Fritz avatar  avatar JMV avatar Radoaslav Nedyalkov avatar KellyDC avatar Nuno Faria avatar  avatar Jay Ma avatar Zs. Csaba Sz. avatar jarzzzi avatar Alex avatar Michael Leonard avatar razor avatar Prathak Paisanwatcharakit avatar Gustav Rydstedt avatar Dimitrios Kanellopoulos avatar  avatar Olivier Sturbois avatar Simon Schaufelberger avatar Cameron Kalegi avatar Ruud avatar  avatar  avatar Colin Liu avatar HyperSimon avatar Renato avatar Alex Carpenter avatar Brennan Moore avatar Yu Wei avatar Thomas avatar Albert Tavares de Almeida avatar devdoomari avatar Rocky Bevins avatar madvic avatar  avatar  avatar Chamnap Chhorn avatar  avatar Nick Rempel avatar Israel Estrada avatar Ben Ashkan avatar Rankin Zheng avatar Adam avatar Stephen Richardson  avatar Newton Kitonga avatar Roli Züger avatar Roman avatar Evans Thompson avatar  avatar  avatar Rahav Lussato avatar  avatar  avatar Gino avatar Mohd Farhan Firdaus Jamil avatar DaveStacey avatar Trieu Truong avatar Jon Shaffer avatar Giuseppe Tazzi avatar yychun1217 avatar  avatar Thomas Rosen avatar Dustin avatar Brian Uosseph avatar Vianney Carel avatar 小傅 avatar Tyler Harden avatar Kosta Korenkov avatar Mustafa Bahadır Pakalın avatar Malek Mammar avatar  avatar  avatar O avatar Hsu Subang avatar Tijs De Boeck avatar Angus H. avatar Juan Ignacio Agu avatar Ludwig Bratke avatar Quentin avatar  avatar Khoa Nguyen avatar costas michalostamou avatar Kav Singh avatar  avatar José Cage  avatar Canmor Lam avatar Nicolai avatar Mesut UZUN avatar Jerry Harrison avatar Karan Singh Sisodia avatar

Watchers

Pieter Jansen van Vuuren avatar Salvaro avatar Timo Mika Gläßer avatar Ryan Walker avatar Aleksei Grebenshchikov avatar Leonid S. Knyshov avatar  avatar  avatar  avatar sean avatar James Cloos avatar  avatar Valentin Ursuleac avatar Sven Wehmeier avatar  avatar  avatar Ed avatar Rodrigo Porcionato avatar  avatar  avatar Krystian Czekalski avatar  avatar  avatar

phoneformat.js's Issues

formatE164 error

Hey, I was implementing a test file for phone numbers using protractor in angularjs and came across this error which I thought I should point it out..
error message:

Expected '+1123456' not to be defined.
    Error: Expected '+1123456' not to be defined.

code line:

  expect(formatE164('US','123456')).not.toBeDefined();

And I think formatE164 should return 'undefined' in this case instead of putting +1 in front of invalid U.S number...

bower installs incorrect version of phoneformat

It seems as you forgot to pull the changes before creating the 1.0.1 tag. So the tagged version in actually the same version as 1.0.0. This will cause bower to download the wrong version.

You need to remove the local and remote 1.0.1 tag, pull the latest changes t local local repo and then recreate and push the 1.0.1 tag again. Here's a cheatsheet

git tag -d 1.0.1
git push --delete origin 1.0.1
git pull
git tag 1.0.1
git push origin 1.0.1

False verification prefix

The function isValidNumber return true for CH country format but is false.
Prefix for switzerland is 0041 but with 0031(and other) return true.
console.log: number and isValidNumber
console log

Is there a way to get a smaller version of this library?

I'm using webpack to build my project and I included this as my library. However this library add over 500+ KB to my project and that's a considerable size:

[526] ./~/phoneformat.js/dist/phone-format-exports.js 507 kB {0} [built]

Is there a way to shrink the size of this library?

isValidNumber always returns false

Steps to reproduce:

  1. Download PhoneFormat.js
  2. Create an html file and reference PhoneFormat.js
  3. In the browser console, call isValidNumber with a valid number.

Expected: Function returns true
Actual: Function returns false

The problem appears to be the missing country code in the call to parseAndKeepRawInput in isValidNumber:

var number = phoneUtil.parseAndKeepRawInput(phone, "");

The call is throwing an invalid country code exception.

Try entering the same number at PhoneFormat.com and note the number is reported as valid. This is because the site is using an older version PhoneFormat.js, before the country code was removed in this commit: 46a2fa4

How can i connect with Jquery validation plugin

Hai Al Cheetah -

This is wonderful plugin, am not familiar in javascript, but i need to validate phonenumber based on country like google signup validator, how can i inculude this plugin in to my Jquery validation plugin. if you can please help me. Thank you.

Mobile number validation for US and India

Nice library! Thanks for this!

We are trying to incorporate your library in our solution. And we've two questions to ask you:

  1. We've country names and based on that we would like to validate phone number for example :
    isValidNumber("PHONENUMBER", "COUNTRY NAME"); e.g.

isValidNumber("9998063528", "India");

Now, to do that, we've created one function which returns country code from Country name e.g.

var aCountryCode = countryNameToCode("India");

/Convert the country name to a code
country name (String) to 2 digit country code
/
function countryNameToCode(countryName) {

var arrCountryCode = new Array();
arrCountryCode['Afghanistan'] = "AF";
arrCountryCode['Albania'] = "AL";
arrCountryCode['Algeria'] = "DZ";
arrCountryCode['American Samoa'] = "AS";
arrCountryCode['Andorra'] = "AD";
arrCountryCode['Angola'] = "AO";
arrCountryCode['Anguilla'] = "AI";
arrCountryCode['Antarctica'] = "AQ";
arrCountryCode['Antigua And Barbuda'] = "AG";
arrCountryCode['Argentina'] = "AR";
arrCountryCode['Armenia'] = "AM";
arrCountryCode['Aruba'] = "AW";
arrCountryCode['Ascension Island'] = "AC";
arrCountryCode['Australia'] = "AU";
arrCountryCode['Austria'] = "AT";
arrCountryCode['Azerbaijan'] = "AZ";
arrCountryCode['Bahamas'] = "BS";
arrCountryCode['Bahrain'] = "BH";
arrCountryCode['Bangladesh'] = "BD";
arrCountryCode['Barbados'] = "BB";
arrCountryCode['Belarus'] = "BY";
arrCountryCode['Belgium'] = "BE";
arrCountryCode['Belize'] = "BZ";
arrCountryCode['Benin'] = "BJ";
arrCountryCode['Bermuda'] = "BM";
arrCountryCode['Bhutan'] = "BT";
arrCountryCode['Bolivia'] = "BO";
arrCountryCode['Bosnia And Herzegovina'] = "BA";
arrCountryCode['Botswana'] = "BW";
arrCountryCode['Bouvet Island'] = "BV";
arrCountryCode['Brazil'] = "BR";
arrCountryCode['British Indian Ocean Territory'] = "IO";
arrCountryCode['Brunei'] = "BN";
arrCountryCode['Bulgaria'] = "BG";
arrCountryCode['Burkina Faso'] = "BF";
arrCountryCode['Burundi'] = "BI";
arrCountryCode['Cambodia'] = "KH";
arrCountryCode['Cameroon'] = "CM";
arrCountryCode['Canada'] = "CA";
arrCountryCode['Cape Verde'] = "CV";
arrCountryCode['Cayman Islands'] = "KY";
arrCountryCode['Central African Republic'] = "CF";
arrCountryCode['Chad'] = "TD";
arrCountryCode['Chile'] = "CL";
arrCountryCode['China'] = "CN";
arrCountryCode['Christmas Island'] = "CX";
arrCountryCode['Cocos (Keeling) Islands'] = "CC";
arrCountryCode['Columbia'] = "CO";
arrCountryCode['Comoros'] = "KM";
arrCountryCode['Congo'] = "CG";
arrCountryCode['Cook Islands'] = "CK";
arrCountryCode['Costa Rica'] = "CR";
arrCountryCode['Cote D\'Ivorie (Ivory Coast)'] = "CI";
arrCountryCode['Croatia (Hrvatska)'] = "HR";
arrCountryCode['Cuba'] = "CU";
arrCountryCode['Cyprus'] = "CY";
arrCountryCode['Czech Republic'] = "CZ";
arrCountryCode['Democratic Republic Of Congo (Zaire)'] = "CD";
arrCountryCode['Denmark'] = "DK";
arrCountryCode['Djibouti'] = "DJ";
arrCountryCode['Dominica'] = "DM";
arrCountryCode['Dominican Republic'] = "DO";
arrCountryCode['East Timor'] = "TL";
arrCountryCode['Ecuador'] = "EC";
arrCountryCode['Egypt'] = "EG";
arrCountryCode['El Salvador'] = "SV";
arrCountryCode['Equatorial Guinea'] = "GQ";
arrCountryCode['Eritrea'] = "ER";
arrCountryCode['Estonia'] = "EE";
arrCountryCode['Ethiopia'] = "ET";
arrCountryCode['Falkland Islands (Malvinas)'] = "FK";
arrCountryCode['Faroe Islands'] = "FO";
arrCountryCode['Fiji'] = "FJ";
arrCountryCode['Finland'] = "FI";
arrCountryCode['France'] = "FR";
arrCountryCode['France, Metropolitan'] = "FX";
arrCountryCode['French Guinea'] = "GF";
arrCountryCode['French Polynesia'] = "PF";
arrCountryCode['French Southern Territories'] = "TF";
arrCountryCode['Gabon'] = "GA";
arrCountryCode['Gambia'] = "GM";
arrCountryCode['Georgia'] = "GE";
arrCountryCode['Germany'] = "DE";
arrCountryCode['Ghana'] = "GH";
arrCountryCode['Gibraltar'] = "GI";
arrCountryCode['Greece'] = "GR";
arrCountryCode['Greenland'] = "GL";
arrCountryCode['Grenada'] = "GD";
arrCountryCode['Guadeloupe'] = "GP";
arrCountryCode['Guam'] = "GU";
arrCountryCode['Guatemala'] = "GT";
arrCountryCode['Guinea'] = "GN";
arrCountryCode['Guinea-Bissau'] = "GW";
arrCountryCode['Guyana'] = "GY";
arrCountryCode['Haiti'] = "HT";
arrCountryCode['Heard And McDonald Islands'] = "HM";
arrCountryCode['Honduras'] = "HN";
arrCountryCode['Hong Kong'] = "HK";
arrCountryCode['Hungary'] = "HU";
arrCountryCode['Iceland'] = "IS";
arrCountryCode['India'] = "IN";
arrCountryCode['Indonesia'] = "ID";
arrCountryCode['Iran'] = "IR";
arrCountryCode['Iraq'] = "IQ";
arrCountryCode['Ireland'] = "IE";
arrCountryCode['Isle of Man'] = "IM";
arrCountryCode['Israel'] = "IL";
arrCountryCode['Italy'] = "IT";
arrCountryCode['Jamaica'] = "JM";
arrCountryCode['Japan'] = "JP";
arrCountryCode['Jordan'] = "JO";
arrCountryCode['Kazakhstan'] = "KZ";
arrCountryCode['Kenya'] = "KE";
arrCountryCode['Kiribati'] = "KI";
arrCountryCode['Kuwait'] = "KW";
arrCountryCode['Kyrgyzstan'] = "KG";
arrCountryCode['Laos'] = "LA";
arrCountryCode['Latvia'] = "LV";
arrCountryCode['Lebanon'] = "LB";
arrCountryCode['Lesotho'] = "LS";
arrCountryCode['Liberia'] = "LR";
arrCountryCode['Libya'] = "LY";
arrCountryCode['Liechtenstein'] = "LI";
arrCountryCode['Lithuania'] = "LT";
arrCountryCode['Luxembourg'] = "LU";
arrCountryCode['Macau'] = "MO";
arrCountryCode['Macedonia'] = "MK";
arrCountryCode['Madagascar'] = "MG";
arrCountryCode['Malawi'] = "MW";
arrCountryCode['Malaysia'] = "MY";
arrCountryCode['Maldives'] = "MV";
arrCountryCode['Mali'] = "ML";
arrCountryCode['Malta'] = "MT";
arrCountryCode['Marshall Islands'] = "MH";
arrCountryCode['Martinique'] = "MQ";
arrCountryCode['Mauritania'] = "MR";
arrCountryCode['Mauritius'] = "MU";
arrCountryCode['Mayotte'] = "YT";
arrCountryCode['Mexico'] = "MX";
arrCountryCode['Micronesia'] = "FM";
arrCountryCode['Moldova'] = "MD";
arrCountryCode['Monaco'] = "MC";
arrCountryCode['Mongolia'] = "MN";
arrCountryCode['Montenegro'] = "ME";
arrCountryCode['Montserrat'] = "MS";
arrCountryCode['Morocco'] = "MA";
arrCountryCode['Mozambique'] = "MZ";
arrCountryCode['Myanmar (Burma)'] = "MM";
arrCountryCode['Namibia'] = "NA";
arrCountryCode['Nauru'] = "NR";
arrCountryCode['Nepal'] = "NP";
arrCountryCode['Netherlands'] = "NL";
arrCountryCode['Netherlands Antilles'] = "AN";
arrCountryCode['New Caledonia'] = "NC";
arrCountryCode['New Zealand'] = "NZ";
arrCountryCode['Nicaragua'] = "NI";
arrCountryCode['Niger'] = "NE";
arrCountryCode['Nigeria'] = "NG";
arrCountryCode['Niue'] = "NU";
arrCountryCode['Norfolk Island'] = "NF";
arrCountryCode['North Korea'] = "KP";
arrCountryCode['Northern Mariana Islands'] = "MP";
arrCountryCode['Norway'] = "NO";
arrCountryCode['Oman'] = "OM";
arrCountryCode['Pakistan'] = "PK";
arrCountryCode['Palau'] = "PW";
arrCountryCode['Palestine'] = "PS";
arrCountryCode['Panama'] = "PA";
arrCountryCode['Papua New Guinea'] = "PG";
arrCountryCode['Paraguay'] = "PY";
arrCountryCode['Peru'] = "PE";
arrCountryCode['Philippines'] = "PH";
arrCountryCode['Pitcairn'] = "PN";
arrCountryCode['Poland'] = "PL";
arrCountryCode['Portugal'] = "PT";
arrCountryCode['Puerto Rico'] = "PR";
arrCountryCode['Qatar'] = "QA";
arrCountryCode['Reunion'] = "RE";
arrCountryCode['Romania'] = "RO";
arrCountryCode['Russia'] = "RU";
arrCountryCode['Rwanda'] = "RW";
arrCountryCode['Saint Helena'] = "SH";
arrCountryCode['Saint Kitts And Nevis'] = "KN";
arrCountryCode['Saint Lucia'] = "LC";
arrCountryCode['Saint Pierre And Miquelon'] = "PM";
arrCountryCode['Saint Vincent And The Grenadines'] = "VC";
arrCountryCode['San Marino'] = "SM";
arrCountryCode['Sao Tome And Principe'] = "ST";
arrCountryCode['Saudi Arabia'] = "SA";
arrCountryCode['Senegal'] = "SN";
arrCountryCode['Serbia'] = "RS";
arrCountryCode['Seychelles'] = "SC";
arrCountryCode['Sierra Leone'] = "SL";
arrCountryCode['Singapore'] = "SG";
arrCountryCode['Slovak Republic'] = "SK";
arrCountryCode['Slovenia'] = "SI";
arrCountryCode['Solomon Islands'] = "SB";
arrCountryCode['Somalia'] = "SO";
arrCountryCode['South Africa'] = "ZA";
arrCountryCode['South Georgia And South Sandwich Islan'] = "GS";
arrCountryCode['South Korea'] = "KR";
arrCountryCode['Spain'] = "ES";
arrCountryCode['Sri Lanka'] = "LK";
arrCountryCode['Sudan'] = "SD";
arrCountryCode['Suriname'] = "SR";
arrCountryCode['Svalbard And Jan Mayen'] = "SJ";
arrCountryCode['Swaziland'] = "SZ";
arrCountryCode['Sweden'] = "SE";
arrCountryCode['Switzerland'] = "CH";
arrCountryCode['Syria'] = "SY";
arrCountryCode['Taiwan'] = "TW";
arrCountryCode['Tajikistan'] = "TJ";
arrCountryCode['Tanzania'] = "TZ";
arrCountryCode['Thailand'] = "TH";
arrCountryCode['Togo'] = "TG";
arrCountryCode['Tokelau'] = "TK";
arrCountryCode['Tonga'] = "TO";
arrCountryCode['Trinidad And Tobago'] = "TT";
arrCountryCode['Tunisia'] = "TN";
arrCountryCode['Turkey'] = "TR";
arrCountryCode['Turkmenistan'] = "TM";
arrCountryCode['Turks And Caicos Islands'] = "TC";
arrCountryCode['Tuvalu'] = "TV";
arrCountryCode['Uganda'] = "UG";
arrCountryCode['Ukraine'] = "UA";
arrCountryCode['United Arab Emirates'] = "AE";
arrCountryCode['United Kingdom'] = "GB";
arrCountryCode['United States'] = "US";
arrCountryCode['United States Minor Outlying Islands'] = "UM";
arrCountryCode['Uruguay'] = "UY";
arrCountryCode['Uzbekistan'] = "UZ";
arrCountryCode['Vanuatu'] = "VU";
arrCountryCode['Vatican City (Holy See)'] = "VA";
arrCountryCode['Venezuela'] = "VE";
arrCountryCode['Vietnam'] = "VN";
arrCountryCode['Virgin Islands (British)'] = "VG";
arrCountryCode['Virgin Islands (US)'] = "VI";
arrCountryCode['Wallis And Futuna Islands'] = "WF";
arrCountryCode['Western Sahara'] = "EH";
arrCountryCode['Western Samoa'] = "WS";
arrCountryCode['Yemen'] = "YE";
arrCountryCode['Yugoslavia'] = "YU";
arrCountryCode['Zambia'] = "ZM";
arrCountryCode['Zimbabwe'] = "ZW";

// TODO : Do we need to store country name in array while storing? I think we don't need it
// that's why removing this code -- countryName.toUpperCase()
var code = arrCountryCode[countryName];
if (code === undefined) {
    return "";
} else {
    return code;
}

}

Is it fine? Or there is better way to do it?

  1. Also, when we open http://phoneformat.com/ and enter any U.S. number and select "India" then only it says it's valid number. This is how it works? Logically it is right as total number's count is 10. But just wanted to have your views.

Thanks,
Kiran

Minimised version will throw error

The minimised version of phone-format-global.min.js throw the following error when embedded as a script in html file:

Uncaught SyntaxError: Invalid regular expression: /[֑-ۯۺ-߿��-﷿ﹰ-ﻼ]/: Range out of order in character class

I am wondering if some tools wrongly minimize the lib from google.

isValidNumber references global 'country' var

isValidNumber does not take in a country input, but uses the global country variable set in source.js on the phoneformat.com site. This method does not take in a country and uses an empty string as the country code in the library version of PhoneFormat.js.

00

Hi.

0048666555444 and +48666555444 are valid numbers but for phoneformat.js only +48666555444 is valid.

Regards,
Adam

Phoneformat api is duplicated in js files

It looks like there is something wrong with the grunt build configuration since the API functions seems to be included more than once

e.g. the formatInternational method can be found on line 978 and line 1968
in phone-format.js file.
This problem occurs for all other files as well.

This is critical since the files size is quite large (865.901 kb unminimized). It looks like it is twice as large as the google-libraries.js file.

No Extension handling

Libphonenumber offers handling of extensions using the x1234 or ext.1234 format. Can you add that, please?

Also, how would I write a function to return my Local format number broken into the parts? I'm only doing US numbers so it would be CountryCode, AreaCode and Number, plus the extension, if you add it.

Request for bower support

Hi,

Thanks for the great work on this, really appreciate it a lot.
Was wondering if you'd consider adding bower support for this project (http://bower.io/)

Doing a bower install phoneformat would be helluva easier =)

phoneformat.com

Hi,

Have you noticed that your demo site domain needs renewing so your online demo isn't available?

Great tool btw.

Thanks

International format does not prefix the country code

Entering the phone number 8646978257 on the phoneformat.com will result in the same number for national and international: (864) 697-8257

I would have expected the number to be: +1 (864) 697-8257
The E164 does output the country code: +18646978257

can't bundle with Webpack 4

After trying to upgrade from webpack 1 to 4 with babel 7, I can't run my application. I'm getting formatLocal is no a function, when I try to use the package as I used to.

after browsing the source files loaded to chrome, I see that phone-format-exports.js but I feels like webpack can't match phoneformat.js import to phone-format-exports.js file.

Did anyone succeed in running phoneformat.js on modern bundle systems?

Thanks!

Germany number validation error

I am validating and then applying local formatting to a field in a form.
If I put a valid German number and the function applies the format, the field turns invalid.

Example:
I input 015733974709, field is marked as valid (according the lib)
The function formatLocal turns it into "01573 3974709"
The validation triggers again and marks the field as invalid.

There isn't a bower.json

It would be really good if there was a bower.json with main defined because now it's required to manually override this in the project bower.json and define the main there.

cleanPhone() method may be unnecessary and problematic

First, thanks much @albeebe for putting this together. Definitely saved me a lot of time.

Quick question: Is there any special reason why we are sanitizing the raw input of non numeric characters with the cleanPhone() method as opposed to just allowing libphonenumber to determine whether or not the phone number is valid?

One use case where allowing characters in the input would be useful is when you have a number like 1-800-CONTACT (1-800-266-8228) or 1-800-ASK-USPS (1-800-275-8777). Google's libphonenumber actually parses characters using the correct corresponding digit and let's you know if it is valid or not (both valid in this case).

Incorrect phone number valiadtion

I'm using ember! this is the snippet

let value = this.get('value'); // +91876543210!@#$%
if (!isValidNumber(value)) { }

The above number is accepted as valid number. But obviously its not. But in
another eg: +91876543210$%^23 //invalid number
Am I doing it right?

Compilling closure on closure-compiler throws some errors!

Hi, i tried to update my version of phoneformat.js following your instructions because I tried a valid number it didn't recognize as so. But the compillation failed and i got these errors:

Number of errors: 9

JSC_MISSING_PROVIDE_ERROR: required "goog.dom" namespace never provided at line 13 character 0
goog.require('goog.dom');
^
JSC_MISSING_PROVIDE_ERROR: required "goog.json" namespace never provided at line 14 character 0
goog.require('goog.json');
^
JSC_MISSING_PROVIDE_ERROR: required "goog.proto2.ObjectSerializer" namespace never provided at line 15 character 0
goog.require('goog.proto2.ObjectSerializer');
^
JSC_MISSING_PROVIDE_ERROR: required "goog.string.StringBuffer" namespace never provided at line 16 character 0
goog.require('goog.string.StringBuffer');
^
JSC_MISSING_PROVIDE_ERROR: required "i18n.phonenumbers.AsYouTypeFormatter" namespace never provided at line 17 character 0
goog.require('i18n.phonenumbers.AsYouTypeFormatter');
^
JSC_MISSING_PROVIDE_ERROR: required "i18n.phonenumbers.PhoneNumberFormat" namespace never provided at line 18 character 0
goog.require('i18n.phonenumbers.PhoneNumberFormat');
^
JSC_MISSING_PROVIDE_ERROR: required "i18n.phonenumbers.PhoneNumberType" namespace never provided at line 19 character 0
goog.require('i18n.phonenumbers.PhoneNumberType');
^
JSC_MISSING_PROVIDE_ERROR: required "i18n.phonenumbers.PhoneNumberUtil" namespace never provided at line 20 character 0
goog.require('i18n.phonenumbers.PhoneNumberUtil');
^
JSC_MISSING_PROVIDE_ERROR: required "i18n.phonenumbers.PhoneNumberUtil.ValidationResult" namespace never provided at line 21 character 0
goog.require('i18n.phonenumbers.PhoneNumberUtil.ValidationResult');
^

bower install phoneformat.js#1.0.0 --save fails

It is not possible to specify the version to install in the bower.json file since you have not created a git tag for the release version 1.0.0.

It is a part of the release process to create a tag in git with the release version name. See http://bower.io/docs/creating-packages/

Please create the git branch 1.0.0 with

git br 1.0.0

and then push it to github with

git push origin 1.0.0

to fix this issue

Conflict with i18n library

Hi!!

I've found a problem with phoneformat library.

I've used http://i18next.com/ library to do translations The problem is that it also declares a i18n global variable as phoneformat.js then this global variable is overwritten and the library doesn't work correctly.

I think that you could change this global variable name for other because i18n is a common library to manage translations and a lot of people use it.

Thank you.

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.