{"id":13454711,"url":"https://github.com/ruimarinho/google-libphonenumber","last_synced_at":"2025-12-12T03:41:15.992Z","repository":{"id":22769994,"uuid":"26115910","full_name":"ruimarinho/google-libphonenumber","owner":"ruimarinho","description":"The up-to-date and reliable Google's libphonenumber package for node.js.","archived":false,"fork":false,"pushed_at":"2025-09-17T13:47:57.000Z","size":7052,"stargazers_count":1465,"open_issues_count":18,"forks_count":152,"subscribers_count":28,"default_branch":"master","last_synced_at":"2025-10-19T16:56:56.325Z","etag":null,"topics":["formatter","libphonenumber","parser","phone"],"latest_commit_sha":null,"homepage":"https://ruimarinho.github.io/google-libphonenumber","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ruimarinho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"ruimarinho"}},"created_at":"2014-11-03T11:37:12.000Z","updated_at":"2025-10-07T00:55:23.000Z","dependencies_parsed_at":"2024-01-11T18:12:28.608Z","dependency_job_id":"1af46bae-a20b-4d83-b6fe-2638989bab1a","html_url":"https://github.com/ruimarinho/google-libphonenumber","commit_stats":{"total_commits":327,"total_committers":16,"mean_commits":20.4375,"dds":0.308868501529052,"last_synced_commit":"3e6636ef33ede50b40a4072c3c3a8fcbe4ca119a"},"previous_names":["seegno/google-libphonenumber"],"tags_count":128,"template":false,"template_full_name":null,"purl":"pkg:github/ruimarinho/google-libphonenumber","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruimarinho%2Fgoogle-libphonenumber","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruimarinho%2Fgoogle-libphonenumber/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruimarinho%2Fgoogle-libphonenumber/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruimarinho%2Fgoogle-libphonenumber/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ruimarinho","download_url":"https://codeload.github.com/ruimarinho/google-libphonenumber/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruimarinho%2Fgoogle-libphonenumber/sbom","scorecard":{"id":789386,"data":{"date":"2025-08-11","repo":{"name":"github.com/ruimarinho/google-libphonenumber","commit":"9dd7ec0e8c5fe8d5ef01d2776e5afb6e5732f3d1"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Maintained","score":10,"reason":"7 commit(s) and 10 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 1/25 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yaml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/ruimarinho/google-libphonenumber/ci.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/ruimarinho/google-libphonenumber/ci.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/ruimarinho/google-libphonenumber/ci.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/ruimarinho/google-libphonenumber/ci.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/ruimarinho/google-libphonenumber/ci.yaml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/ci.yaml:35","Warn: npmCommand not pinned by hash: .github/workflows/ci.yaml:23","Info:   0 out of   5 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 9 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"17 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-qrpm-p2h7-hrv2","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T07:02:35.641Z","repository_id":22769994,"created_at":"2025-08-23T07:02:35.641Z","updated_at":"2025-08-23T07:02:35.641Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280038604,"owners_count":26261869,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-20T02:00:06.978Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["formatter","libphonenumber","parser","phone"],"created_at":"2024-07-31T08:00:57.212Z","updated_at":"2025-10-20T07:09:01.274Z","avatar_url":"https://github.com/ruimarinho.png","language":"JavaScript","readme":"# google-libphonenumber\n\nThe up-to-date and reliable Google's libphonenumber package for node.js. Zero dependencies.\n\n## Status\n\n[![npm version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![install size][packagephobia-image]][packagephobia-url]\n\n## Introduction\n\nGoogle's [libphonenumber](https://github.com/googlei18n/libphonenumber) is a library that parses, formats, stores and validates international phone numbers. It is used by Android since version 4.0 and is a phenomenal repository of carrier metadata.\n\nAlthough it compiles down to Java, C++ and JS, its JS port is tightly coupled to the Google Closure library. This makes it more difficult to directly require and use the code on a node.js project.\n\nGoogle eventually started publishing [google-closure-library](https://www.npmjs.com/package/google-closure-library) directly to NPM, ending years of ill-maintained community packages. However, running the original library on node.js [remains a cumbersome process](https://github.com/googlei18n/libphonenumber/tree/master/javascript).\n\nAfter all these years, Google's libphonenumber is still not officially available on NPM. What is the best way to use Google's libphonenumber on node.js then? If you're looking for a convenient and easy method, that's what this package is all about.\n\n## Installation\n\nInstall the package via `npm`:\n\n```sh\nnpm install --save-prod google-libphonenumber\n```\n\n## Usage\n\nThe following is a simple phone information extraction example similar to what can be viewed on the official demo page.\n\n⚠️ _Most libphonenumber functions expect to receive an instance of `libphonenumber.PhoneNumber` which can be obtained by calling `phoneUtil.parse` or `phoneUtil.parseAndKeepRawInput` on a raw (string) number, otherwise it will throw errors like `TypeError: a.getCountryCodeOrDefault is not a function`._\n\nThis **will** work:\n\n```js\nphoneUtil.isValidNumberForRegion(phoneUtil.parse('202-456-1414', 'US'), 'US');\n```\n\nThis **will not** work:\n\n```js\nphoneUtil.isValidNumberForRegion('202-456-1414', 'US');\n```\n\nMore API examples after parsing the raw string:\n\n```js\n// Require `PhoneNumberFormat`.\nconst PNF = require('google-libphonenumber').PhoneNumberFormat;\n\n// Get an instance of `PhoneNumberUtil`.\nconst phoneUtil = require('google-libphonenumber').PhoneNumberUtil.getInstance();\n\n// Parse number with country code and keep raw input.\nconst number = phoneUtil.parseAndKeepRawInput('202-456-1414', 'US');\n\n// Print the phone's country code.\nconsole.log(number.getCountryCode());\n// =\u003e 1\n\n// Print the phone's national number.\nconsole.log(number.getNationalNumber());\n// =\u003e 2024561414\n\n// Print the phone's extension.\nconsole.log(number.getExtension());\n// =\u003e\n\n// Print the phone's extension when compared to i18n.phonenumbers.CountryCodeSource.\nconsole.log(number.getCountryCodeSource());\n// =\u003e FROM_DEFAULT_COUNTRY\n\n// Print the phone's italian leading zero.\nconsole.log(number.getItalianLeadingZero());\n// =\u003e false\n\n// Print the phone's raw input.\nconsole.log(number.getRawInput());\n// =\u003e 202-456-1414\n\n// Result from isPossibleNumber().\nconsole.log(phoneUtil.isPossibleNumber(number));\n// =\u003e true\n\n// Result from isValidNumber().\nconsole.log(phoneUtil.isValidNumber(number));\n// =\u003e true\n\n// Result from isValidNumberForRegion().\nconsole.log(phoneUtil.isValidNumberForRegion(number, 'US'));\n// =\u003e true\n\n// Result from getRegionCodeForNumber().\nconsole.log(phoneUtil.getRegionCodeForNumber(number));\n// =\u003e US\n\n// Result from getNumberType() when compared to i18n.phonenumbers.PhoneNumberType.\nconsole.log(phoneUtil.getNumberType(number));\n// =\u003e FIXED_LINE_OR_MOBILE\n\n// Format number in the E164 format.\nconsole.log(phoneUtil.format(number, PNF.E164));\n// =\u003e +12024561414\n\n// Format number in the original format.\nconsole.log(phoneUtil.formatInOriginalFormat(number, 'US'));\n// =\u003e (202) 456-1414\n\n// Format number in the national format.\nconsole.log(phoneUtil.format(number, PNF.NATIONAL));\n// =\u003e (202) 456-1414\n\n// Format number in the international format.\nconsole.log(phoneUtil.format(number, PNF.INTERNATIONAL));\n// =\u003e +1 202-456-1414\n\n// Format number in the out-of-country format from US.\nconsole.log(phoneUtil.formatOutOfCountryCallingNumber(number, 'US'));\n// =\u003e 1 (202) 456-1414\n\n// Format number in the out-of-country format from CH.\nconsole.log(phoneUtil.formatOutOfCountryCallingNumber(number, 'CH'));\n// =\u003e 00 1 202-456-1414\n```\n\n#### Using the \"As You Type\" Formatter\n\nThe \"As You Type\" formatter is a specialized tool that show the formatting *progress* as it attempts to discover the right format for the given number. It requires registering every keystroke (input digit) on a new instance of the `AsYouTypeFormatter` as shown below.\n\n```js\n// Require `AsYouTypeFormatter`.\nconst AsYouTypeFormatter = require('google-libphonenumber').AsYouTypeFormatter;\nconst formatter = new AsYouTypeFormatter('US');\n\nconsole.log(formatter.inputDigit('2')); // =\u003e 2\nconsole.log(formatter.inputDigit('0')); // =\u003e 20\nconsole.log(formatter.inputDigit('2')); // =\u003e 202\nconsole.log(formatter.inputDigit('-')); // =\u003e 202-\nconsole.log(formatter.inputDigit('4')); // =\u003e 202-4\nconsole.log(formatter.inputDigit('5')); // =\u003e 202-45\nconsole.log(formatter.inputDigit('6')); // =\u003e 202-456\nconsole.log(formatter.inputDigit('-')); // =\u003e 202-456-\nconsole.log(formatter.inputDigit('1')); // =\u003e 202-456-1\nconsole.log(formatter.inputDigit('4')); // =\u003e 202-456-14\nconsole.log(formatter.inputDigit('1')); // =\u003e 202-456-141\nconsole.log(formatter.inputDigit('4')); // =\u003e 202-456-1414\n\n// Cleanup all input digits from instance.\nformatter.clear();\n```\n\n## Methods\n\nA quick glance at Google's libphonenumber rich API. Descriptions sourced from original files.\n\n### i18n.phonenumbers.PhoneNumberUtil\n\nThe class that offers the main utilities to work with phone numbers, such as formatting, parsing and validating.\n\nHighlights:\n\n* **format(number, numberFormat)** - formats a phone number in the specified format using default rules.\n* **formatInOriginalFormat(number, regionCallingFrom)** - formats a phone number using the original phone number format that the number is parsed from.\n* **formatOutOfCountryCallingNumber(number, regionCallingFrom)** - formats a phone number for out-of-country dialing purposes.\n* **getNumberType(number)** - gets the type of a valid phone number.\n* **getRegionCodeForNumber(number)** - returns the region where a phone number is from.\n* **isPossibleNumber(number)** - returns true if the number is either a possible fully-qualified number (containing the area code and country code), or if the number could be a possible local number (with a country code, but missing an area code).\n* **isValidNumber(number)** - tests whether a phone number matches a valid pattern.\n* **isValidNumberForRegion(number, regionCode)** - tests whether a phone number is valid for a certain region.\n* **parseAndKeepRawInput(numberToParse, defaultRegion)** - parses a string and returns it in proto buffer format while keeping the raw input value.\n* **parse(numberToParse, defaultRegion)** - parses a string and returns it in proto buffer format.\n\n### i18n.phonenumbers.PhoneNumber\n\nThe type of the phone returned after a string number has been parsed via `PhoneNumberUtil.parse()` or `PhoneNumberUtil.parseAndKeepRawInput()`.\n\nHighlights:\n\n* **getCountryCode()**\n* **getCountryCodeSource()**\n* **getExtension()**\n* **getItalianLeadingZero()**\n* **getNationalNumber()**\n* **getRawInput()**\n\n## i18n.phonenumbers.CountryCodeSource\n\nLists the following enums in order to compare them with the output of `Phone.getCountryCodeSource()`:\n\n* `CountryCodeSource.UNSPECIFIED`\n* `CountryCodeSource.FROM_NUMBER_WITH_PLUS_SIGN`\n* `CountryCodeSource.FROM_NUMBER_WITH_IDD`\n* `CountryCodeSource.FROM_NUMBER_WITHOUT_PLUS_SIGN`\n* `CountryCodeSource.FROM_DEFAULT_COUNTRY`\n\n## i18n.phonenumbers.PhoneNumberFormat\n\nLists the following enums in order to pass them to `PhoneNumberUtil.format()`:\n\n* `PhoneNumberFormat.E164`\n* `PhoneNumberFormat.INTERNATIONAL`\n* `PhoneNumberFormat.NATIONAL`\n* `PhoneNumberFormat.RFC3966`\n\n## i18n.phonenumbers.PhoneNumberType\n\nLists the following enums in order to compare them with the output of `PhoneNumberUtil.getNumberType()`:\n\n* `PhoneNumberType.FIXED_LINE`\n* `PhoneNumberType.MOBILE`\n* `PhoneNumberType.FIXED_LINE_OR_MOBILE`\n* `PhoneNumberType.TOLL_FREE`\n* `PhoneNumberType.PREMIUM_RATE`\n* `PhoneNumberType.SHARED_COST`\n* `PhoneNumberType.VOIP`\n* `PhoneNumberType.PERSONAL_NUMBER`\n* `PhoneNumberType.PAGER`\n* `PhoneNumberType.UAN`\n* `PhoneNumberType.VOICEMAIL`\n* `PhoneNumberType.UNKNOWN`\n\n### i18n.phonenumbers.ShortNumberInfo\n\nHighlights:\n\n* **connectsToEmergencyNumber(number, regionCode)** - tests whether the short number can be used to connect to emergency services when dialed from the given region.\n* **isPossibleShortNumber(number)** - tests whether a short number is a possible number.\n* **isPossibleShortNumberForRegion(number, regionDialingFrom)** - tests whether a short number is a possible number when dialed from the given region.\n* **isValidShortNumber(number)** - tests whether a short number is a possible number.\n* **isValidShortNumberForRegion(number, regionDialingFrom)** - tests whether a short number matches a valid pattern in a region.\n\n```js\n// Get an instance of `ShortNumberInfo`.\nconst shortInfo = require('google-libphonenumber').ShortNumberInfo.getInstance();\n\n// Get an instance of `PhoneNumberUtil`.\nconst phoneUtil = require('google-libphonenumber').PhoneNumberUtil.getInstance();\n\n// Result from connectsToEmergencyNumber().\nconsole.log(shortInfo.connectsToEmergencyNumber('911', 'US'));\n// =\u003e true\n\n// Result from isPossibleShortNumber().\nconsole.log(shortInfo.isPossibleShortNumber(phoneUtil.parse('123456', 'FR')));\n// =\u003e true\n\n// Result from isPossibleShortNumberForRegion().\nconsole.log(shortInfo.isPossibleShortNumberForRegion(phoneUtil.parse('123456', 'FR'), 'FR'));\n// =\u003e true\n```\n\n### Unavailable methods and classes\n\nThe following methods or classes are unavailable on the original JS port of Google's libphonenumber:\n\n* findNumbers - finds numbers in text (useful for highlighting or linking phone numbers inside text messages).\n* PhoneNumberOfflineGeocoder - provides geographical information related to a phone number.\n* PhoneNumberToCarrierMapper - provides carrier information related to a phone number.\n* PhoneNumberToTimeZonesMapper - provides timezone information related to a phone number.\n\n## Notes\n\n### Metadata issues\n\nMost of the issues submitted to this repository are related to carrier metadata - things like unexpected phone validations, errors in formatting numbers, unknown carriers and so on.\n\nFirst, try the same input using the [official demo page](http://libphonenumber.appspot.com). If the result is different, then it might mean that a metadata update is due on this package, as the demo page always runs on the latest and official metadata version.\n\nIf the result is the same, it means there might be an issue with the currently available metadata. In that case, you should report your issue in the original project's [issue tracker](https://issuetracker.google.com/issues?q=componentid:192347) ([moved out of GitHub on 05/12/2017](https://groups.google.com/forum/#!topic/libphonenumber-discuss/bcCh0175LME)).\n\nThis note will be posted on every issue regarding metadata troubles and it will be automatically closed.\n\n### Differences from other packages\n\n`google-libphonenumber` does not try to be more than what it really is - a pre-compiled Google libphonenumber bundle that works on node.js. It is a **1:1 mirror** of the original library without any further simplifications or optimizations.\n\n* All classes available from `libphonenumber` are exported as-is. No magic methods.\n* Always based on the latest `google-closure` library version available from Google with performance and bug fixes.\n* Relies on a simplified and [well-documented update process](https://github.com/ruimarinho/google-libphonenumber/blob/master/bin/update.sh) to keep the underlying `libphonenumber` library always up-to-date.\n\nIf you're looking for a slightly simpler API, you should try [awesome-phonenumber](https://www.npmjs.com/package/awesome-phonenumber). It is based on the same concepts of this package but changes the API in order to make it more user friendly. You run the risk of bumping into [other](https://github.com/grantila/awesome-phonenumber/issues/14) [bugs](https://github.com/grantila/awesome-phonenumber/issues/17) and you'll have to [learn new API types](https://github.com/grantila/awesome-phonenumber#api-types), but that's the necessary trade-off that the author made for achieving a generally better looking API.\n\n[libphonenumber-js](https://www.npmjs.com/package/libphonenumber-js) is a much more radical approach to Google's libphonenumber. It is a rewrite of the original library based on its source phone metadata but implemented without depending on the Google Closure library. It also offers a tool to reduce the metadata to a set of countries which might be useful for frontend projects. It has several [caveats](https://github.com/catamphetamine/libphonenumber-js#difference-from-googles-libphonenumber), many of which make a lot of sense depending on the project, but you will have to ascertain those yourself.\n\n## Webpack\n\nThere have been some users reporting successful but also unsuccessful usage with Webpack. While I don't personally use it, I'm 100% supportive of pull requests adding modifications that allow this package to better interact with it.\n\n### Chrome Extensions\n\nGoogle Closure Compiler API, a serviced provided by Google to compile code online via its Closure library, may not always return fully compliant UTF-8-encoded output.\n\nLoading extensions using this library on Google Chrome and other Chromium-based browsers may result in the following error when compiled with webpack:\n\n`Could not load file 'file.js' for content script. It isn't UTF-8 encoded.`\n\nWhile the local Java-based version supports a parameter which would let us workaround this issue at the source using `--charset=US-ASCII`, the online API version, which is a lot more convenient to use, does not offer support for an equivalent parameter (e.g. `output_charset=US-ASCII`).\n\nIn order to workaround this issue when using webpack, make sure to output US-ASCII characters only when defining `TerserPlugin` options, as demonstrated below:\n\n```js\noptimization: {\n  minimize: process.env.NODE_ENV !== 'development',\n  minimizer: [\n    new TerserPlugin({\n      terserOptions: {\n        output: {\n          ascii_only: true\n        }\n      },\n    }),\n  ]\n}\n```\n\n## Tests\n\nA small subset of tests guarantees that the main library functions are working as expected and are correctly exported. The actual heavy lifting is done by `libphonenumber`'s extensive test suite.\n\n```sh\nnpm test\n```\n\n## Release\n\n```sh\nnpm version [\u003cnewversion\u003e | major | minor | patch] -m \"Release %s\"\n```\n\n## Acknowledgments\n\nThe exceptional work on `libphonenumber` was made possible by these [committers and contributors](https://github.com/googlei18n/libphonenumber/graphs/contributors).\n\n## Licenses\n\nThis package is licensed under MIT. The bundled [libphonenumber](https://github.com/googlei18n/libphonenumber/blob/master/LICENSE) library is licensed under Apache 2.0.\n\n[npm-image]: https://flat.badgen.net/npm/v/google-libphonenumber\n[npm-url]: https://npmjs.org/package/google-libphonenumber\n[travis-image]: https://flat.badgen.net/travis/ruimarinho/google-libphonenumber\n[travis-url]: https://travis-ci.org/ruimarinho/google-libphonenumber\n[packagephobia-image]: https://flat.badgen.net/packagephobia/install/google-libphonenumber\n[packagephobia-url]: https://packagephobia.now.sh/result?p=google-libphonenumber\n","funding_links":["https://github.com/sponsors/ruimarinho"],"categories":["Packages","包"],"sub_categories":["Parsing","解析"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruimarinho%2Fgoogle-libphonenumber","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fruimarinho%2Fgoogle-libphonenumber","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruimarinho%2Fgoogle-libphonenumber/lists"}