libphonenumber-js 1.10.0 → 1.10.3

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.
@@ -0,0 +1,55 @@
1
+ 'use strict'
2
+
3
+ // This file is deprecated.
4
+ // It's the same as `index.cjs`, just with an added `.js` file extension.
5
+ // It only exists for compatibility with the software that doesn't like `*.cjs` file extension.
6
+ // https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/61#note_950728292
7
+
8
+ var parsePhoneNumberFromString = require('../build/parsePhoneNumberFromString.js').default
9
+
10
+ // ES5 `require()` "default" "interoperability" hack.
11
+ // https://github.com/babel/babel/issues/2212#issuecomment-131827986
12
+ // An alternative approach:
13
+ // https://www.npmjs.com/package/babel-plugin-add-module-exports
14
+ exports = module.exports = parsePhoneNumberFromString
15
+ exports['default'] = parsePhoneNumberFromString
16
+
17
+ exports.ParseError = require('../build/ParseError.js').default
18
+ var parsePhoneNumberWithError = require('../build/parsePhoneNumber.js').default
19
+ // `parsePhoneNumber()` named export has been renamed to `parsePhoneNumberWithError()`.
20
+ exports.parsePhoneNumberWithError = parsePhoneNumberWithError
21
+ exports.parsePhoneNumber = parsePhoneNumberWithError
22
+
23
+ // `parsePhoneNumberFromString()` named export is now considered legacy:
24
+ // it has been promoted to a default export due to being too verbose.
25
+ exports.parsePhoneNumberFromString = parsePhoneNumberFromString
26
+
27
+ exports.isValidPhoneNumber = require('../build/isValidPhoneNumber.js').default
28
+ exports.isPossiblePhoneNumber = require('../build/isPossiblePhoneNumber.js').default
29
+ exports.validatePhoneNumberLength = require('../build/validatePhoneNumberLength.js').default
30
+
31
+ exports.findNumbers = require('../build/findNumbers.js').default
32
+ exports.searchNumbers = require('../build/searchNumbers.js').default
33
+ exports.findPhoneNumbersInText = require('../build/findPhoneNumbersInText.js').default
34
+ exports.searchPhoneNumbersInText = require('../build/searchPhoneNumbersInText.js').default
35
+ exports.PhoneNumberMatcher = require('../build/PhoneNumberMatcher.js').default
36
+
37
+ exports.AsYouType = require('../build/AsYouType.js').default
38
+
39
+ exports.Metadata = require('../build/metadata.js').default
40
+ exports.isSupportedCountry = require('../build/metadata.js').isSupportedCountry
41
+ exports.getCountries = require('../build/getCountries.js').default
42
+ exports.getCountryCallingCode = require('../build/metadata.js').getCountryCallingCode
43
+ exports.getExtPrefix = require('../build/metadata.js').getExtPrefix
44
+
45
+ exports.getExampleNumber = require('../build/getExampleNumber.js').default
46
+
47
+ exports.formatIncompletePhoneNumber = require('../build/formatIncompletePhoneNumber.js').default
48
+
49
+ exports.parseIncompletePhoneNumber = require('../build/parseIncompletePhoneNumber.js').default
50
+ exports.parsePhoneNumberCharacter = require('../build/parseIncompletePhoneNumber.js').parsePhoneNumberCharacter
51
+ exports.parseDigits = require('../build/helpers/parseDigits.js').default
52
+ exports.DIGIT_PLACEHOLDER = require('../build/AsYouTypeFormatter.js').DIGIT_PLACEHOLDER
53
+
54
+ exports.parseRFC3966 = require('../build/helpers/RFC3966.js').parseRFC3966
55
+ exports.formatRFC3966 = require('../build/helpers/RFC3966.js').formatRFC3966
package/index.common.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // This file is deprecated.
4
4
  // It's only for backwards compatibility with Node.js versions < 14.
5
5
 
6
- var min = require('./min/index.commonjs.js')
6
+ var min = require('./min/index.cjs')
7
7
  var metadata = require('./metadata.min.json')
8
8
 
9
9
  function withMetadata(func, _arguments) {
@@ -0,0 +1,112 @@
1
+ 'use strict'
2
+
3
+ // This file is deprecated.
4
+ // It's the same as `index.cjs`, just with an added `.js` file extension.
5
+ // It only exists for compatibility with the software that doesn't like `*.cjs` file extension.
6
+ // https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/61#note_950728292
7
+
8
+ var metadata = require('../metadata.max.json')
9
+ var core = require('../core/index.cjs')
10
+
11
+ function call(func, _arguments) {
12
+ var args = Array.prototype.slice.call(_arguments)
13
+ args.push(metadata)
14
+ return func.apply(this, args)
15
+ }
16
+
17
+ function parsePhoneNumberFromString() {
18
+ return call(core.parsePhoneNumberFromString, arguments)
19
+ }
20
+
21
+ // ES5 `require()` "default" "interoperability" hack.
22
+ // https://github.com/babel/babel/issues/2212#issuecomment-131827986
23
+ // An alternative approach:
24
+ // https://www.npmjs.com/package/babel-plugin-add-module-exports
25
+ exports = module.exports = parsePhoneNumberFromString
26
+ exports['default'] = parsePhoneNumberFromString
27
+
28
+ exports.ParseError = core.ParseError
29
+
30
+ function parsePhoneNumberWithError() {
31
+ return call(core.parsePhoneNumberWithError, arguments)
32
+ }
33
+
34
+ // `parsePhoneNumber()` named export has been renamed to `parsePhoneNumberWithError()`.
35
+ exports.parsePhoneNumber = parsePhoneNumberWithError
36
+ exports.parsePhoneNumberWithError = parsePhoneNumberWithError
37
+
38
+ // `parsePhoneNumberFromString()` named export is now considered legacy:
39
+ // it has been promoted to a default export due to being too verbose.
40
+ exports.parsePhoneNumberFromString = parsePhoneNumberFromString
41
+
42
+ exports.isValidPhoneNumber = function isValidPhoneNumber() {
43
+ return call(core.isValidPhoneNumber, arguments)
44
+ }
45
+
46
+ exports.isPossiblePhoneNumber = function isPossiblePhoneNumber() {
47
+ return call(core.isPossiblePhoneNumber, arguments)
48
+ }
49
+
50
+ exports.validatePhoneNumberLength = function validatePhoneNumberLength() {
51
+ return call(core.validatePhoneNumberLength, arguments)
52
+ }
53
+
54
+ exports.findNumbers = function findNumbers() {
55
+ return call(core.findNumbers, arguments)
56
+ }
57
+
58
+ exports.searchNumbers = function searchNumbers() {
59
+ return call(core.searchNumbers, arguments)
60
+ }
61
+
62
+ exports.findPhoneNumbersInText = function findPhoneNumbersInText() {
63
+ return call(core.findPhoneNumbersInText, arguments)
64
+ }
65
+
66
+ exports.searchPhoneNumbersInText = function searchPhoneNumbersInText() {
67
+ return call(core.searchPhoneNumbersInText, arguments)
68
+ }
69
+
70
+ exports.PhoneNumberMatcher = function PhoneNumberMatcher(text, options) {
71
+ return core.PhoneNumberMatcher.call(this, text, options, metadata)
72
+ }
73
+ exports.PhoneNumberMatcher.prototype = Object.create(core.PhoneNumberMatcher.prototype, {})
74
+ exports.PhoneNumberMatcher.prototype.constructor = exports.PhoneNumberMatcher
75
+
76
+ exports.AsYouType = function AsYouType(country) {
77
+ return core.AsYouType.call(this, country, metadata)
78
+ }
79
+ exports.AsYouType.prototype = Object.create(core.AsYouType.prototype, {})
80
+ exports.AsYouType.prototype.constructor = exports.AsYouType
81
+
82
+ exports.isSupportedCountry = function isSupportedCountry(country) {
83
+ return call(core.isSupportedCountry, arguments)
84
+ }
85
+
86
+ exports.getCountries = function getCountries() {
87
+ return call(core.getCountries, arguments)
88
+ }
89
+
90
+ exports.getCountryCallingCode = function getCountryCallingCode() {
91
+ return call(core.getCountryCallingCode, arguments)
92
+ }
93
+
94
+ exports.getExtPrefix = function getExtPrefix(country) {
95
+ return call(core.getExtPrefix, arguments)
96
+ }
97
+
98
+ exports.getExampleNumber = function getExampleNumber() {
99
+ return call(core.getExampleNumber, arguments)
100
+ }
101
+
102
+ exports.formatIncompletePhoneNumber = function formatIncompletePhoneNumber() {
103
+ return call(core.formatIncompletePhoneNumber, arguments)
104
+ }
105
+
106
+ exports.parseIncompletePhoneNumber = core.parseIncompletePhoneNumber
107
+ exports.parsePhoneNumberCharacter = core.parsePhoneNumberCharacter
108
+ exports.parseDigits = core.parseDigits
109
+ exports.DIGIT_PLACEHOLDER = core.DIGIT_PLACEHOLDER
110
+
111
+ exports.parseRFC3966 = core.parseRFC3966
112
+ exports.formatRFC3966 = core.formatRFC3966
@@ -0,0 +1,118 @@
1
+ 'use strict'
2
+
3
+ // This file is deprecated.
4
+ // It's the same as `index.cjs`, just with an added `.js` file extension.
5
+ // It only exists for compatibility with the software that doesn't like `*.cjs` file extension.
6
+ // https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/61#note_950728292
7
+
8
+ var metadata = require('../metadata.min.json')
9
+ var core = require('../core/index.cjs')
10
+
11
+ function call(func, _arguments) {
12
+ var args = Array.prototype.slice.call(_arguments)
13
+ args.push(metadata)
14
+ return func.apply(this, args)
15
+ }
16
+
17
+ function parsePhoneNumberFromString() {
18
+ return call(core.parsePhoneNumberFromString, arguments)
19
+ }
20
+
21
+ // ES5 `require()` "default" "interoperability" hack.
22
+ // https://github.com/babel/babel/issues/2212#issuecomment-131827986
23
+ // An alternative approach:
24
+ // https://www.npmjs.com/package/babel-plugin-add-module-exports
25
+ exports = module.exports = parsePhoneNumberFromString
26
+ exports['default'] = parsePhoneNumberFromString
27
+
28
+ exports.ParseError = core.ParseError
29
+
30
+ function parsePhoneNumberWithError() {
31
+ return call(core.parsePhoneNumberWithError, arguments)
32
+ }
33
+
34
+ // `parsePhoneNumber()` named export has been renamed to `parsePhoneNumberWithError()`.
35
+ exports.parsePhoneNumber = parsePhoneNumberWithError
36
+ exports.parsePhoneNumberWithError = parsePhoneNumberWithError
37
+
38
+ // `parsePhoneNumberFromString()` named export is now considered legacy:
39
+ // it has been promoted to a default export due to being too verbose.
40
+ exports.parsePhoneNumberFromString = parsePhoneNumberFromString
41
+
42
+ exports.isValidPhoneNumber = function isValidPhoneNumber() {
43
+ return call(core.isValidPhoneNumber, arguments)
44
+ }
45
+
46
+ exports.isPossiblePhoneNumber = function isPossiblePhoneNumber() {
47
+ return call(core.isPossiblePhoneNumber, arguments)
48
+ }
49
+
50
+ exports.validatePhoneNumberLength = function validatePhoneNumberLength() {
51
+ return call(core.validatePhoneNumberLength, arguments)
52
+ }
53
+
54
+ exports.findNumbers = function findNumbers() {
55
+ return call(core.findNumbers, arguments)
56
+ }
57
+
58
+ exports.searchNumbers = function searchNumbers() {
59
+ return call(core.searchNumbers, arguments)
60
+ }
61
+
62
+ exports.findPhoneNumbersInText = function findPhoneNumbersInText() {
63
+ return call(core.findPhoneNumbersInText, arguments)
64
+ }
65
+
66
+ exports.searchPhoneNumbersInText = function searchPhoneNumbersInText() {
67
+ return call(core.searchPhoneNumbersInText, arguments)
68
+ }
69
+
70
+ exports.PhoneNumberMatcher = function PhoneNumberMatcher(text, options) {
71
+ return core.PhoneNumberMatcher.call(this, text, options, metadata)
72
+ }
73
+ exports.PhoneNumberMatcher.prototype = Object.create(core.PhoneNumberMatcher.prototype, {})
74
+ exports.PhoneNumberMatcher.prototype.constructor = exports.PhoneNumberMatcher
75
+
76
+ exports.AsYouType = function AsYouType(country) {
77
+ return core.AsYouType.call(this, country, metadata)
78
+ }
79
+ exports.AsYouType.prototype = Object.create(core.AsYouType.prototype, {})
80
+ exports.AsYouType.prototype.constructor = exports.AsYouType
81
+
82
+ exports.isSupportedCountry = function isSupportedCountry(country) {
83
+ return call(core.isSupportedCountry, arguments)
84
+ }
85
+
86
+ exports.getCountries = function getCountries() {
87
+ return call(core.getCountries, arguments)
88
+ }
89
+
90
+ exports.getCountryCallingCode = function getCountryCallingCode() {
91
+ return call(core.getCountryCallingCode, arguments)
92
+ }
93
+
94
+ exports.getExtPrefix = function getExtPrefix(country) {
95
+ return call(core.getExtPrefix, arguments)
96
+ }
97
+
98
+ exports.getExampleNumber = function getExampleNumber() {
99
+ return call(core.getExampleNumber, arguments)
100
+ }
101
+
102
+ exports.Metadata = function Metadata() {
103
+ return core.Metadata.call(this, metadata)
104
+ }
105
+ exports.Metadata.prototype = Object.create(core.Metadata.prototype, {})
106
+ exports.Metadata.prototype.constructor = exports.Metadata
107
+
108
+ exports.formatIncompletePhoneNumber = function formatIncompletePhoneNumber() {
109
+ return call(core.formatIncompletePhoneNumber, arguments)
110
+ }
111
+
112
+ exports.parseIncompletePhoneNumber = core.parseIncompletePhoneNumber
113
+ exports.parsePhoneNumberCharacter = core.parsePhoneNumberCharacter
114
+ exports.parseDigits = core.parseDigits
115
+ exports.DIGIT_PLACEHOLDER = core.DIGIT_PLACEHOLDER
116
+
117
+ exports.parseRFC3966 = core.parseRFC3966
118
+ exports.formatRFC3966 = core.formatRFC3966
@@ -0,0 +1,112 @@
1
+ 'use strict'
2
+
3
+ // This file is deprecated.
4
+ // It's the same as `index.cjs`, just with an added `.js` file extension.
5
+ // It only exists for compatibility with the software that doesn't like `*.cjs` file extension.
6
+ // https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/61#note_950728292
7
+
8
+ var metadata = require('../metadata.mobile.json')
9
+ var core = require('../core/index.cjs')
10
+
11
+ function call(func, _arguments) {
12
+ var args = Array.prototype.slice.call(_arguments)
13
+ args.push(metadata)
14
+ return func.apply(this, args)
15
+ }
16
+
17
+ function parsePhoneNumberFromString() {
18
+ return call(core.parsePhoneNumberFromString, arguments)
19
+ }
20
+
21
+ // ES5 `require()` "default" "interoperability" hack.
22
+ // https://github.com/babel/babel/issues/2212#issuecomment-131827986
23
+ // An alternative approach:
24
+ // https://www.npmjs.com/package/babel-plugin-add-module-exports
25
+ exports = module.exports = parsePhoneNumberFromString
26
+ exports['default'] = parsePhoneNumberFromString
27
+
28
+ exports.ParseError = core.ParseError
29
+
30
+ function parsePhoneNumberWithError() {
31
+ return call(core.parsePhoneNumberWithError, arguments)
32
+ }
33
+
34
+ // `parsePhoneNumber()` named export has been renamed to `parsePhoneNumberWithError()`.
35
+ exports.parsePhoneNumber = parsePhoneNumberWithError
36
+ exports.parsePhoneNumberWithError = parsePhoneNumberWithError
37
+
38
+ // `parsePhoneNumberFromString()` named export is now considered legacy:
39
+ // it has been promoted to a default export due to being too verbose.
40
+ exports.parsePhoneNumberFromString = parsePhoneNumberFromString
41
+
42
+ exports.isValidPhoneNumber = function isValidPhoneNumber() {
43
+ return call(core.isValidPhoneNumber, arguments)
44
+ }
45
+
46
+ exports.isPossiblePhoneNumber = function isPossiblePhoneNumber() {
47
+ return call(core.isPossiblePhoneNumber, arguments)
48
+ }
49
+
50
+ exports.validatePhoneNumberLength = function validatePhoneNumberLength() {
51
+ return call(core.validatePhoneNumberLength, arguments)
52
+ }
53
+
54
+ exports.findNumbers = function findNumbers() {
55
+ return call(core.findNumbers, arguments)
56
+ }
57
+
58
+ exports.searchNumbers = function searchNumbers() {
59
+ return call(core.searchNumbers, arguments)
60
+ }
61
+
62
+ exports.findPhoneNumbersInText = function findPhoneNumbersInText() {
63
+ return call(core.findPhoneNumbersInText, arguments)
64
+ }
65
+
66
+ exports.searchPhoneNumbersInText = function searchPhoneNumbersInText() {
67
+ return call(core.searchPhoneNumbersInText, arguments)
68
+ }
69
+
70
+ exports.PhoneNumberMatcher = function PhoneNumberMatcher(text, options) {
71
+ return core.PhoneNumberMatcher.call(this, text, options, metadata)
72
+ }
73
+ exports.PhoneNumberMatcher.prototype = Object.create(core.PhoneNumberMatcher.prototype, {})
74
+ exports.PhoneNumberMatcher.prototype.constructor = exports.PhoneNumberMatcher
75
+
76
+ exports.AsYouType = function AsYouType(country) {
77
+ return core.AsYouType.call(this, country, metadata)
78
+ }
79
+ exports.AsYouType.prototype = Object.create(core.AsYouType.prototype, {})
80
+ exports.AsYouType.prototype.constructor = exports.AsYouType
81
+
82
+ exports.isSupportedCountry = function isSupportedCountry(country) {
83
+ return call(core.isSupportedCountry, arguments)
84
+ }
85
+
86
+ exports.getCountries = function getCountries() {
87
+ return call(core.getCountries, arguments)
88
+ }
89
+
90
+ exports.getCountryCallingCode = function getCountryCallingCode() {
91
+ return call(core.getCountryCallingCode, arguments)
92
+ }
93
+
94
+ exports.getExtPrefix = function getExtPrefix(country) {
95
+ return call(core.getExtPrefix, arguments)
96
+ }
97
+
98
+ exports.getExampleNumber = function getExampleNumber() {
99
+ return call(core.getExampleNumber, arguments)
100
+ }
101
+
102
+ exports.formatIncompletePhoneNumber = function formatIncompletePhoneNumber() {
103
+ return call(core.formatIncompletePhoneNumber, arguments)
104
+ }
105
+
106
+ exports.parseIncompletePhoneNumber = core.parseIncompletePhoneNumber
107
+ exports.parsePhoneNumberCharacter = core.parsePhoneNumberCharacter
108
+ exports.parseDigits = core.parseDigits
109
+ exports.DIGIT_PLACEHOLDER = core.DIGIT_PLACEHOLDER
110
+
111
+ exports.parseRFC3966 = core.parseRFC3966
112
+ exports.formatRFC3966 = core.formatRFC3966
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libphonenumber-js",
3
- "version": "1.10.0",
3
+ "version": "1.10.3",
4
4
  "description": "A simpler (and smaller) rewrite of Google Android's libphonenumber library in javascript",
5
5
  "main": "index.common.js",
6
6
  "module": "index.js",
@@ -14,22 +14,22 @@
14
14
  "./min": {
15
15
  "types": "./min/index.d.ts",
16
16
  "import": "./min/index.js",
17
- "require": "./min/index.commonjs.js"
17
+ "require": "./min/index.cjs"
18
18
  },
19
19
  "./max": {
20
20
  "types": "./min/index.d.ts",
21
21
  "import": "./max/index.js",
22
- "require": "./max/index.commonjs.js"
22
+ "require": "./max/index.cjs"
23
23
  },
24
24
  "./mobile": {
25
25
  "types": "./min/index.d.ts",
26
26
  "import": "./mobile/index.js",
27
- "require": "./mobile/index.commonjs.js"
27
+ "require": "./mobile/index.cjs"
28
28
  },
29
29
  "./core": {
30
30
  "types": "./core/index.d.ts",
31
31
  "import": "./core/index.js",
32
- "require": "./core/index.commonjs.js"
32
+ "require": "./core/index.cjs"
33
33
  },
34
34
  "./metadata.min": {
35
35
  "types": "./metadata.min.json.d.ts",
@@ -80,7 +80,8 @@
80
80
  "types": "./examples.mobile.json.d.ts",
81
81
  "import": "./examples.mobile.json.js",
82
82
  "require": "./examples.mobile.json"
83
- }
83
+ },
84
+ "./package.json": "./package.json"
84
85
  },
85
86
  "sideEffects": false,
86
87
  "dependencies": {},