google-libphonenumber 3.2.11 → 3.2.15
Sign up to get free protection for your applications and to get access to all the features.
- package/.github/FUNDING.yml +1 -0
- package/.github/workflows/ci.yaml +46 -0
- package/README.md +16 -0
- package/dist/libphonenumber.js +1135 -7369
- package/package.json +6 -6
- package/CHANGELOG.md +0 -823
@@ -0,0 +1 @@
|
|
1
|
+
github: ruimarinho
|
@@ -0,0 +1,46 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
tags:
|
8
|
+
- '*'
|
9
|
+
pull_request:
|
10
|
+
branches:
|
11
|
+
- '*'
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
test:
|
15
|
+
name: Run Tests
|
16
|
+
runs-on: ubuntu-latest
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v2
|
19
|
+
- uses: actions/setup-node@v1
|
20
|
+
with:
|
21
|
+
node-version: 10
|
22
|
+
- run: npm install
|
23
|
+
- run: npm test
|
24
|
+
publish:
|
25
|
+
name: Publish Release
|
26
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
27
|
+
runs-on: ubuntu-latest
|
28
|
+
steps:
|
29
|
+
- uses: actions/checkout@v2
|
30
|
+
- uses: actions/setup-node@v1
|
31
|
+
with:
|
32
|
+
node-version: 10
|
33
|
+
registry-url: https://registry.npmjs.org/
|
34
|
+
- run: npm install
|
35
|
+
- run: npm publish
|
36
|
+
env:
|
37
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
38
|
+
- uses: actions/create-release@v1
|
39
|
+
env:
|
40
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
41
|
+
with:
|
42
|
+
tag_name: ${{ github.ref }}
|
43
|
+
release_name: ${{ github.ref }}
|
44
|
+
body: |
|
45
|
+
## Changelog
|
46
|
+
draft: true
|
package/README.md
CHANGED
@@ -30,6 +30,22 @@ npm install --save-prod google-libphonenumber
|
|
30
30
|
|
31
31
|
The following is a simple phone information extraction example similar to what can be viewed on the official demo page.
|
32
32
|
|
33
|
+
⚠️ _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`._
|
34
|
+
|
35
|
+
This **will** work:
|
36
|
+
|
37
|
+
```js
|
38
|
+
phoneUtil.isValidNumberForRegion(phoneUtil.parse('202-456-1414', 'US'), 'US');
|
39
|
+
```
|
40
|
+
|
41
|
+
This **will not** work:
|
42
|
+
|
43
|
+
```js
|
44
|
+
phoneUtil.isValidNumberForRegion('202-456-1414', 'US');
|
45
|
+
```
|
46
|
+
|
47
|
+
More API examples after parsing the raw string:
|
48
|
+
|
33
49
|
```js
|
34
50
|
// Require `PhoneNumberFormat`.
|
35
51
|
const PNF = require('google-libphonenumber').PhoneNumberFormat;
|