libphonenumber-js 1.10.4 → 1.10.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -926,7 +926,7 @@ Although Google's javascript port doesn't have the `findPhoneNumbersInText()` fu
926
926
  Returns an example phone number for a [country](#country-code). Returns an instance of [`PhoneNumber`](#phonenumber) class. Will return `undefined` if `country` doesn't exist or isn't supported by this library.
927
927
 
928
928
  ```js
929
- import examples from 'libphonenumber-js/examples.mobile.json'
929
+ import examples from 'libphonenumber-js/mobile/examples'
930
930
  import { getExampleNumber } from 'libphonenumber-js'
931
931
 
932
932
  const phoneNumber = getExampleNumber('RU', examples)
@@ -1456,9 +1456,9 @@ Using with custom metadata:
1456
1456
  ```js
1457
1457
  import { Metadata } from 'libphonenumber-js/core'
1458
1458
 
1459
- import min from 'libphonenumber-js/metadata.min.json'
1460
- // import max from 'libphonenumber-js/metadata.max.json'
1461
- // import mobile from 'libphonenumber-js/metadata.mobile.json'
1459
+ import min from 'libphonenumber-js/min/metadata'
1460
+ // import max from 'libphonenumber-js/max/metadata'
1461
+ // import mobile from 'libphonenumber-js/mobile/metadata'
1462
1462
 
1463
1463
  const metadata = new Metadata(min)
1464
1464
  ```
@@ -1505,7 +1505,7 @@ import _parsePhoneNumber, {
1505
1505
  AsYouType as _AsYouType
1506
1506
  } from 'libphonenumber-js/core'
1507
1507
 
1508
- import metadata from 'libphonenumber-js/metadata.max.json'
1508
+ import metadata from 'libphonenumber-js/max/metadata'
1509
1509
 
1510
1510
  function call(func, _arguments) {
1511
1511
  var args = Array.prototype.slice.call(_arguments)
@@ -1532,7 +1532,7 @@ And for [Common.js](https://auth0.com/blog/javascript-module-systems-showdown/)
1532
1532
 
1533
1533
  ```js
1534
1534
  var core = require('libphonenumber-js/core')
1535
- var metadata = require('libphonenumber-js/metadata.max.json')
1535
+ var metadata = require('libphonenumber-js/max/metadata')
1536
1536
 
1537
1537
  function call(func, _arguments) {
1538
1538
  var args = Array.prototype.slice.call(_arguments)
@@ -1579,7 +1579,7 @@ import {
1579
1579
  AsYouType
1580
1580
  } from 'libphonenumber-js/custom'
1581
1581
 
1582
- import metadata from 'libphonenumber-js/metadata.max.json'
1582
+ import metadata from 'libphonenumber-js/max/metadata'
1583
1583
 
1584
1584
  parseNumber('+78005553535', metadata)
1585
1585
  formatNumber({ phone: '8005553535', country: 'RU' }, metadata)
@@ -1592,7 +1592,7 @@ And for [Common.js](https://auth0.com/blog/javascript-module-systems-showdown/)
1592
1592
 
1593
1593
  ```js
1594
1594
  var custom = require('libphonenumber-js/custom')
1595
- var metadata = require('libphonenumber-js/metadata.max.json')
1595
+ var metadata = require('libphonenumber-js/max/metadata')
1596
1596
 
1597
1597
  exports.parseNumber = function parseNumber() {
1598
1598
  var parameters = Array.prototype.slice.call(arguments)
@@ -1742,9 +1742,35 @@ It will `build`, `test` and then create a `.tgz` archive which you can then inst
1742
1742
  npm install [module name with version].tar.gz
1743
1743
  ```
1744
1744
 
1745
+ ## Tests
1746
+
1747
+ This component comes with a 100% code coverage.
1748
+
1749
+ To run tests:
1750
+
1751
+ ```
1752
+ npm test
1753
+ ```
1754
+
1755
+ To generate a code coverage report:
1756
+
1757
+ ```
1758
+ npm run test-coverage
1759
+ ```
1760
+
1761
+ The code coverage report can be viewed by opening `./coverage/lcov-report/index.html`.
1762
+
1745
1763
  ## Advertisement
1746
1764
 
1747
- If you're looking for an international "2 days ago" javascript solution then check out [`javascript-time-ago`](https://gitlab.com/catamphetamine/javascript-time-ago).
1765
+ If you like this library then you might also like:
1766
+
1767
+ * [`react-phone-number-input`](https://npmjs.com/package/react-phone-number-input) — A `React` component for phone number input.
1768
+ * [`javascript-time-ago`](https://npmjs.com/package/javascript-time-ago) — An international human-readable past or future date formatter. Example: `"2 days ago"`.
1769
+ * [`react-time-ago`](https://npmjs.com/package/react-time-ago) — A `React` component for international human-readable formatting of past or future dates. Example: `"2 days ago"`.
1770
+ * [`read-excel-file`](https://www.npmjs.com/package/read-excel-file) — A simple and easy-to-use `*.xlsx` file reader (client-side or server-side).
1771
+ * [`write-excel-file`](https://www.npmjs.com/package/write-excel-file) — A simple and easy-to-use `*.xlsx` file writer (client-side or server-side).
1772
+ * [`flexible-json-schema`](https://www.npmjs.com/package/flexible-json-schema) — A simple and easy-to-use `*.json` schema data validator / parser.
1773
+ * [`virtual-scroller`](https://www.npmjs.com/package/virtual-scroller) — A universal implementation of a "virtual scroller" infinite list scrolling component: only renders the rows that fit the screen bounds.
1748
1774
 
1749
1775
  ## License
1750
1776
 
@@ -1 +1,5 @@
1
- {"name":"libphonenumber-js/build","type":"commonjs","private":true}
1
+ {
2
+ "name": "libphonenumber-js/build",
3
+ "type": "commonjs",
4
+ "private": true
5
+ }
package/core/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "private": true,
3
- "name": "libphonenumber-js-core",
4
- "version": "1.0.0",
3
+ "name": "libphonenumber-js/core",
5
4
  "main": "index.cjs",
6
5
  "module": "index.js",
7
6
  "type": "module",
@@ -0,0 +1,16 @@
1
+ {
2
+ "private": true,
3
+ "name": "libphonenumber-js/max/metadata",
4
+ "main": "../../metadata.max.json",
5
+ "module": "../../metadata.max.json.js",
6
+ "types": "../../metadata.max.json.d.ts",
7
+ "type": "module",
8
+ "exports": {
9
+ ".": {
10
+ "types": "../../metadata.max.json.d.ts",
11
+ "import": "../../metadata.max.json.js",
12
+ "require": "../../metadata.max.json"
13
+ }
14
+ },
15
+ "sideEffects": false
16
+ }
package/max/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "private": true,
3
- "name": "libphonenumber-js-max",
4
- "version": "1.0.0",
3
+ "name": "libphonenumber-js/max",
5
4
  "main": "index.cjs",
6
5
  "module": "index.js",
7
6
  "types": "../min/index.d.ts",
@@ -0,0 +1,16 @@
1
+ {
2
+ "private": true,
3
+ "name": "libphonenumber-js/min/metadata",
4
+ "main": "../../metadata.min.json",
5
+ "module": "../../metadata.min.json.js",
6
+ "types": "../../metadata.min.json.d.ts",
7
+ "type": "module",
8
+ "exports": {
9
+ ".": {
10
+ "types": "../../metadata.min.json.d.ts",
11
+ "import": "../../metadata.min.json.js",
12
+ "require": "../../metadata.min.json"
13
+ }
14
+ },
15
+ "sideEffects": false
16
+ }
package/min/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "private": true,
3
- "name": "libphonenumber-js-min",
4
- "version": "1.0.0",
3
+ "name": "libphonenumber-js/min",
5
4
  "main": "index.cjs",
6
5
  "module": "index.js",
7
6
  "type": "module",
@@ -0,0 +1,16 @@
1
+ {
2
+ "private": true,
3
+ "name": "libphonenumber-js/mobile/examples",
4
+ "main": "../../examples.mobile.json",
5
+ "module": "../../examples.mobile.json.js",
6
+ "types": "../../examples.mobile.json.d.ts",
7
+ "type": "module",
8
+ "exports": {
9
+ ".": {
10
+ "types": "../../examples.mobile.json.d.ts",
11
+ "import": "../../examples.mobile.json.js",
12
+ "require": "../../examples.mobile.json"
13
+ }
14
+ },
15
+ "sideEffects": false
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "private": true,
3
+ "name": "libphonenumber-js/mobile/metadata",
4
+ "main": "../../metadata.mobile.json",
5
+ "module": "../../metadata.mobile.json.js",
6
+ "types": "../../metadata.mobile.json.d.ts",
7
+ "type": "module",
8
+ "exports": {
9
+ ".": {
10
+ "types": "../../metadata.mobile.json.d.ts",
11
+ "import": "../../metadata.mobile.json.js",
12
+ "require": "../../metadata.mobile.json"
13
+ }
14
+ },
15
+ "sideEffects": false
16
+ }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "private": true,
3
- "name": "libphonenumber-js-mobile",
4
- "version": "1.0.0",
3
+ "name": "libphonenumber-js/mobile",
5
4
  "main": "index.cjs",
6
5
  "module": "index.js",
7
6
  "types": "../min/index.d.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libphonenumber-js",
3
- "version": "1.10.4",
3
+ "version": "1.10.5",
4
4
  "description": "A simpler (and smaller) rewrite of Google Android's libphonenumber library in javascript",
5
5
  "main": "index.cjs",
6
6
  "module": "index.js",
@@ -31,6 +31,11 @@
31
31
  "import": "./core/index.js",
32
32
  "require": "./core/index.cjs"
33
33
  },
34
+ "./min/metadata": {
35
+ "types": "./metadata.min.json.d.ts",
36
+ "import": "./metadata.min.json.js",
37
+ "require": "./metadata.min.json"
38
+ },
34
39
  "./metadata.min": {
35
40
  "types": "./metadata.min.json.d.ts",
36
41
  "import": "./metadata.min.json.js",
@@ -51,6 +56,11 @@
51
56
  "import": "./metadata.max.json.js",
52
57
  "require": "./metadata.max.json"
53
58
  },
59
+ "./max/metadata": {
60
+ "types": "./metadata.max.json.d.ts",
61
+ "import": "./metadata.max.json.js",
62
+ "require": "./metadata.max.json"
63
+ },
54
64
  "./metadata.max": {
55
65
  "types": "./metadata.max.json.d.ts",
56
66
  "import": "./metadata.max.json.js",
@@ -61,6 +71,11 @@
61
71
  "import": "./metadata.max.json.js",
62
72
  "require": "./metadata.max.json"
63
73
  },
74
+ "./mobile/metadata": {
75
+ "types": "./metadata.mobile.json.d.ts",
76
+ "import": "./metadata.mobile.json.js",
77
+ "require": "./metadata.mobile.json"
78
+ },
64
79
  "./metadata.mobile": {
65
80
  "types": "./metadata.mobile.json.d.ts",
66
81
  "import": "./metadata.mobile.json.js",
@@ -71,6 +86,11 @@
71
86
  "import": "./metadata.mobile.json.js",
72
87
  "require": "./metadata.mobile.json"
73
88
  },
89
+ "./mobile/examples": {
90
+ "types": "./examples.mobile.json.d.ts",
91
+ "import": "./examples.mobile.json.js",
92
+ "require": "./examples.mobile.json"
93
+ },
74
94
  "./examples.mobile": {
75
95
  "types": "./examples.mobile.json.d.ts",
76
96
  "import": "./examples.mobile.json.js",
@@ -129,7 +149,7 @@
129
149
  "generate-country-codes": "node --experimental-json-modules runnable/generate-country-codes",
130
150
  "test": "node --experimental-json-modules node_modules/mocha/bin/_mocha --colors --bail --reporter spec --require ./test/setup.js \"source/**/*.test.js\" \"test/**/*.test.js\" --recursive",
131
151
  "test-coverage": "npm-run-all build:commonjs test-coverage:commonjs",
132
- "test-coverage:commonjs": "node --experimental-json-modules node_modules/istanbul/lib/cli.js cover -x \"es6/**\" -x \"*.test.js\" -x \"build/findNumbers/Leniency.js\" -x \"build/findNumbers/RegExpCache.js\" -x \"build/findNumbers/LRUCache.js\" -x \"build/PhoneNumberMatcher.js\" -x \"build/tools/semver-compare.js\" node_modules/mocha/bin/_mocha -- --colors --reporter dot --require ./test/setup.js \"build/**/*.test.js\" --recursive",
152
+ "test-coverage:commonjs": "node --experimental-json-modules node_modules/istanbul/lib/cli.js cover -x \"*.test.js\" -x \"build/findNumbers/Leniency.js\" -x \"build/findNumbers/RegExpCache.js\" -x \"build/findNumbers/LRUCache.js\" -x \"build/PhoneNumberMatcher.js\" -x \"build/tools/semver-compare.js\" node_modules/mocha/bin/_mocha -- --colors --reporter dot --require ./test/setup.js \"build/**/*.test.js\" --recursive",
133
153
  "test-coverage--does-not-work-with-es-modules": "node --experimental-json-modules node_modules/istanbul/lib/cli.js cover -x \"build/**\" -x \"es6/**\" -x \"*.test.js\" -x \"source/findNumbers/Leniency.js\" -x \"source/findNumbers/RegExpCache.js\" -x \"source/findNumbers/LRUCache.js\" -x \"source/PhoneNumberMatcher.js\" -x \"source/tools/semver-compare.js\" node_modules/mocha/bin/_mocha -- --colors --reporter dot --require ./test/setup.js \"source/**/*.test.js\" \"test/**/*.test.js\" --recursive",
134
154
  "test-coverage--nyc--does-not-work-with-es-modules": "cross-env nyc node --experimental-json-modules node_modules/mocha/bin/_mocha --bail --require @babel/register --require ./test/setup.js \"source/**/*.test.js\" \"test/**/*.test.js\"",
135
155
  "coveralls--nyc-is-very-slow-and-is-not-used": "nyc report --reporter=text-lcov | coveralls",
@@ -8,4 +8,4 @@ fs.writeFileSync('./build/package.json', JSON.stringify({
8
8
  name: 'libphonenumber-js/build',
9
9
  type: 'commonjs',
10
10
  private: true
11
- }), 'utf8')
11
+ }, null, 2), 'utf8')