@phonecheck/phone-number-validator-js 1.7.1 → 1.7.3-beta.1

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.
Files changed (101) hide show
  1. package/lib/index.d.ts.map +1 -1
  2. package/lib/index.es.js +5 -2
  3. package/lib/index.js +4 -1
  4. package/lib/locales.d.ts +1 -1
  5. package/lib/locales.d.ts.map +1 -1
  6. package/lib/serverless.cjs.js +543 -256
  7. package/lib/serverless.esm.js +543 -256
  8. package/lib/serverless.esm.min.js +4 -4
  9. package/lib/serverless.umd.js +543 -256
  10. package/lib/serverless.umd.min.js +4 -4
  11. package/package.json +16 -19
  12. package/resources/carrier/en/1.bson +0 -0
  13. package/resources/carrier/en/221.bson +0 -0
  14. package/resources/carrier/en/228.bson +0 -0
  15. package/resources/carrier/en/229.bson +0 -0
  16. package/resources/carrier/en/230.bson +0 -0
  17. package/resources/carrier/en/232.bson +0 -0
  18. package/resources/carrier/en/233.bson +0 -0
  19. package/resources/carrier/en/236.bson +0 -0
  20. package/resources/carrier/en/243.bson +0 -0
  21. package/resources/carrier/en/254.bson +0 -0
  22. package/resources/carrier/en/255.bson +0 -0
  23. package/resources/carrier/en/256.bson +0 -0
  24. package/resources/carrier/en/257.bson +0 -0
  25. package/resources/carrier/en/261.bson +0 -0
  26. package/resources/carrier/en/267.bson +0 -0
  27. package/resources/carrier/en/30.bson +0 -0
  28. package/resources/carrier/en/31.bson +0 -0
  29. package/resources/carrier/en/32.bson +0 -0
  30. package/resources/carrier/en/33.bson +0 -0
  31. package/resources/carrier/en/34.bson +0 -0
  32. package/resources/carrier/en/357.bson +0 -0
  33. package/resources/carrier/en/359.bson +0 -0
  34. package/resources/carrier/en/36.bson +0 -0
  35. package/resources/carrier/en/372.bson +0 -0
  36. package/resources/carrier/en/377.bson +0 -0
  37. package/resources/carrier/en/381.bson +0 -0
  38. package/resources/carrier/en/39.bson +0 -0
  39. package/resources/carrier/en/41.bson +0 -0
  40. package/resources/carrier/en/420.bson +0 -0
  41. package/resources/carrier/en/423.bson +0 -0
  42. package/resources/carrier/en/43.bson +0 -0
  43. package/resources/carrier/en/44.bson +0 -0
  44. package/resources/carrier/en/45.bson +0 -0
  45. package/resources/carrier/en/46.bson +0 -0
  46. package/resources/carrier/en/48.bson +0 -0
  47. package/resources/carrier/en/49.bson +0 -0
  48. package/resources/carrier/en/501.bson +0 -0
  49. package/resources/carrier/en/503.bson +0 -0
  50. package/resources/carrier/en/55.bson +0 -0
  51. package/resources/carrier/en/56.bson +0 -0
  52. package/resources/carrier/en/57.bson +0 -0
  53. package/resources/carrier/en/590.bson +0 -0
  54. package/resources/carrier/en/591.bson +0 -0
  55. package/resources/carrier/en/593.bson +0 -0
  56. package/resources/carrier/en/597.bson +0 -0
  57. package/resources/carrier/en/599.bson +0 -0
  58. package/resources/carrier/en/60.bson +0 -0
  59. package/resources/carrier/en/61.bson +0 -0
  60. package/resources/carrier/en/65.bson +0 -0
  61. package/resources/carrier/en/673.bson +0 -0
  62. package/resources/carrier/en/685.bson +0 -0
  63. package/resources/carrier/en/7.bson +0 -0
  64. package/resources/carrier/en/81.bson +0 -0
  65. package/resources/carrier/en/852.bson +0 -0
  66. package/resources/carrier/en/853.bson +0 -0
  67. package/resources/carrier/en/86.bson +0 -0
  68. package/resources/carrier/en/90.bson +0 -0
  69. package/resources/carrier/en/91.bson +0 -0
  70. package/resources/carrier/en/961.bson +0 -0
  71. package/resources/carrier/en/962.bson +0 -0
  72. package/resources/carrier/en/966.bson +0 -0
  73. package/resources/carrier/en/968.bson +0 -0
  74. package/resources/carrier/en/971.bson +0 -0
  75. package/resources/carrier/en/972.bson +0 -0
  76. package/resources/carrier/en/975.bson +0 -0
  77. package/resources/carrier/en/976.bson +0 -0
  78. package/resources/carrier/en/98.bson +0 -0
  79. package/resources/carrier/en/992.bson +0 -0
  80. package/resources/carrier/en/995.bson +0 -0
  81. package/resources/carrier/en/998.bson +0 -0
  82. package/resources/carrier/fa/98.bson +0 -0
  83. package/resources/carrier/ru/7.bson +0 -0
  84. package/resources/carrier/zh/852.bson +0 -0
  85. package/resources/carrier/zh/86.bson +0 -0
  86. package/resources/geocodes/en/1.bson +0 -0
  87. package/resources/geocodes/en/212.bson +0 -0
  88. package/resources/geocodes/en/229.bson +0 -0
  89. package/resources/geocodes/en/251.bson +0 -0
  90. package/resources/geocodes/en/39.bson +0 -0
  91. package/resources/geocodes/en/48.bson +0 -0
  92. package/resources/geocodes/en/61.bson +0 -0
  93. package/resources/geocodes/en/7.bson +0 -0
  94. package/resources/geocodes/en/91.bson +0 -0
  95. package/resources/geocodes/en/975.bson +0 -0
  96. package/resources/geocodes/fr/212.bson +0 -0
  97. package/resources/geocodes/fr/229.bson +0 -0
  98. package/resources/geocodes/kk/7.bson +0 -0
  99. package/resources/geocodes/pl/48.bson +0 -0
  100. package/resources/geocodes/ru/7.bson +0 -0
  101. package/resources/timezones.bson +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AAKjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAgG9D;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,WAAW,EAAE,WAAW,GAAG,SAAS,EAAE,MAAM,GAAE,cAAqB,iBAE3F;AAED;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,WAAW,EAAE,WAAW,GAAG,SAAS,EAAE,MAAM,GAAE,aAAoB,iBAEzF;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,WAAW,EAAE,WAAW,GAAG,SAAS,mBAmB7D;AAED;;;GAGG;AACH,wBAAgB,UAAU,SAEzB;AAED;;GAEG;AACH,wBAAgB,YAAY,WAE3B;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,QAexC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AAKjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAmG9D;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,WAAW,EAAE,WAAW,GAAG,SAAS,EAAE,MAAM,GAAE,cAAqB,iBAE3F;AAED;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,WAAW,EAAE,WAAW,GAAG,SAAS,EAAE,MAAM,GAAE,aAAoB,iBAEzF;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,WAAW,EAAE,WAAW,GAAG,SAAS,mBAmB7D;AAED;;;GAGG;AACH,wBAAgB,UAAU,SAEzB;AAED;;GAEG;AACH,wBAAgB,YAAY,WAE3B;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,QAexC"}
package/lib/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from 'libphonenumber-js';
2
- import { readFileSync } from 'node:fs';
2
+ import { existsSync, readFileSync } from 'node:fs';
3
3
  import { join } from 'node:path';
4
4
  import { deserialize } from 'bson';
5
5
  import { lru } from 'tiny-lru';
@@ -13,6 +13,9 @@ function getCode(dataPath, nationalNumber) {
13
13
  try {
14
14
  let data = codeDataCache.get(dataPath);
15
15
  if (!data) {
16
+ if (!existsSync(dataPath)) {
17
+ return null;
18
+ }
16
19
  const bData = readFileSync(dataPath);
17
20
  data = deserialize(bData);
18
21
  codeDataCache.set(dataPath, data);
@@ -72,7 +75,7 @@ function carrier(phonenumber, locale = "en") {
72
75
  return getLocalizedData("carrier", phonenumber, locale, "en");
73
76
  }
74
77
  function timezones(phonenumber) {
75
- if (!phonenumber || !phonenumber.number) {
78
+ if (!(phonenumber == null ? void 0 : phonenumber.number)) {
76
79
  return null;
77
80
  }
78
81
  let nr = phonenumber.number.toString();
package/lib/index.js CHANGED
@@ -15,6 +15,9 @@ function getCode(dataPath, nationalNumber) {
15
15
  try {
16
16
  let data = codeDataCache.get(dataPath);
17
17
  if (!data) {
18
+ if (!node_fs.existsSync(dataPath)) {
19
+ return null;
20
+ }
18
21
  const bData = node_fs.readFileSync(dataPath);
19
22
  data = bson.deserialize(bData);
20
23
  codeDataCache.set(dataPath, data);
@@ -74,7 +77,7 @@ function carrier(phonenumber, locale = "en") {
74
77
  return getLocalizedData("carrier", phonenumber, locale, "en");
75
78
  }
76
79
  function timezones(phonenumber) {
77
- if (!phonenumber || !phonenumber.number) {
80
+ if (!(phonenumber == null ? void 0 : phonenumber.number)) {
78
81
  return null;
79
82
  }
80
83
  let nr = phonenumber.number.toString();
package/lib/locales.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export type GeocoderLocale = 'ar' | 'be' | 'bg' | 'bs' | 'de' | 'el' | 'en' | 'es' | 'fa' | 'fi' | 'fr' | 'hr' | 'hu' | 'hy' | 'id' | 'it' | 'iw' | 'ja' | 'ko' | 'nl' | 'pl' | 'pt' | 'ro' | 'ru' | 'sq' | 'sr' | 'sv' | 'th' | 'tr' | 'uk' | 'vi' | 'zh' | 'zh_Hant';
1
+ export type GeocoderLocale = 'ar' | 'be' | 'bg' | 'bs' | 'de' | 'el' | 'en' | 'es' | 'fa' | 'fi' | 'fr' | 'hr' | 'hu' | 'hy' | 'id' | 'it' | 'iw' | 'ja' | 'kk' | 'ko' | 'nl' | 'pl' | 'pt' | 'ro' | 'ru' | 'sq' | 'sr' | 'sv' | 'th' | 'tr' | 'uk' | 'vi' | 'zh' | 'zh_Hant';
2
2
  export type CarrierLocale = 'ar' | 'be' | 'en' | 'fa' | 'ko' | 'ru' | 'uk' | 'zh' | 'zh_Hant';
3
3
  //# sourceMappingURL=locales.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["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