libphonenumber-js 1.12.38 → 1.12.40

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 (254) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/build/AsYouType.test.js +573 -571
  3. package/build/AsYouType.test.js.map +1 -1
  4. package/build/AsYouTypeFormatter.PatternMatcher.test.js +209 -207
  5. package/build/AsYouTypeFormatter.PatternMatcher.test.js.map +1 -1
  6. package/build/AsYouTypeFormatter.PatternParser.test.js +14 -12
  7. package/build/AsYouTypeFormatter.PatternParser.test.js.map +1 -1
  8. package/build/AsYouTypeFormatter.util.test.js +14 -12
  9. package/build/AsYouTypeFormatter.util.test.js.map +1 -1
  10. package/build/PhoneNumber.test.js +60 -58
  11. package/build/PhoneNumber.test.js.map +1 -1
  12. package/build/PhoneNumberMatcher.test.js +26 -24
  13. package/build/PhoneNumberMatcher.test.js.map +1 -1
  14. package/build/findNumbers/util.test.js +16 -14
  15. package/build/findNumbers/util.test.js.map +1 -1
  16. package/build/findPhoneNumbersInText.test.js +67 -65
  17. package/build/findPhoneNumbersInText.test.js.map +1 -1
  18. package/build/format.test.js +71 -69
  19. package/build/format.test.js.map +1 -1
  20. package/build/formatIncompletePhoneNumber.test.js +11 -9
  21. package/build/formatIncompletePhoneNumber.test.js.map +1 -1
  22. package/build/getCountries.test.js +5 -3
  23. package/build/getCountries.test.js.map +1 -1
  24. package/build/getCountryCallingCode.test.js +7 -5
  25. package/build/getCountryCallingCode.test.js.map +1 -1
  26. package/build/getExampleNumber.test.js +10 -8
  27. package/build/getExampleNumber.test.js.map +1 -1
  28. package/build/helpers/RFC3966.test.js +14 -12
  29. package/build/helpers/RFC3966.test.js.map +1 -1
  30. package/build/helpers/applyInternationalSeparatorStyle.test.js +6 -4
  31. package/build/helpers/applyInternationalSeparatorStyle.test.js.map +1 -1
  32. package/build/helpers/checkNumberLength.test.js +29 -27
  33. package/build/helpers/checkNumberLength.test.js.map +1 -1
  34. package/build/helpers/extractCountryCallingCode.test.js +7 -5
  35. package/build/helpers/extractCountryCallingCode.test.js.map +1 -1
  36. package/build/helpers/extractNationalNumber.test.js +7 -5
  37. package/build/helpers/extractNationalNumber.test.js.map +1 -1
  38. package/build/helpers/extractNationalNumberFromPossiblyIncompleteNumber.test.js +5 -3
  39. package/build/helpers/extractNationalNumberFromPossiblyIncompleteNumber.test.js.map +1 -1
  40. package/build/helpers/extractPhoneContext.test.js +5 -3
  41. package/build/helpers/extractPhoneContext.test.js.map +1 -1
  42. package/build/helpers/getNumberType.test.js +7 -6
  43. package/build/helpers/getNumberType.test.js.map +1 -1
  44. package/build/helpers/matchesEntirely.test.js +6 -4
  45. package/build/helpers/matchesEntirely.test.js.map +1 -1
  46. package/build/helpers/mergeArrays.test.js +5 -3
  47. package/build/helpers/mergeArrays.test.js.map +1 -1
  48. package/build/helpers/parseDigits.test.js +5 -3
  49. package/build/helpers/parseDigits.test.js.map +1 -1
  50. package/build/helpers/stripIddPrefix.test.js +11 -9
  51. package/build/helpers/stripIddPrefix.test.js.map +1 -1
  52. package/build/isPossible.test.js +23 -21
  53. package/build/isPossible.test.js.map +1 -1
  54. package/build/isPossiblePhoneNumber.test.js +18 -16
  55. package/build/isPossiblePhoneNumber.test.js.map +1 -1
  56. package/build/isValid.test.js +27 -25
  57. package/build/isValid.test.js.map +1 -1
  58. package/build/isValidPhoneNumber.test.js +12 -10
  59. package/build/isValidPhoneNumber.test.js.map +1 -1
  60. package/build/legacy/findNumbers.test.js +51 -49
  61. package/build/legacy/findNumbers.test.js.map +1 -1
  62. package/build/legacy/findPhoneNumbers.test.js +47 -45
  63. package/build/legacy/findPhoneNumbers.test.js.map +1 -1
  64. package/build/legacy/format.test.js +80 -78
  65. package/build/legacy/format.test.js.map +1 -1
  66. package/build/legacy/getNumberType.test.js +25 -23
  67. package/build/legacy/getNumberType.test.js.map +1 -1
  68. package/build/legacy/isPossibleNumber.test.js +18 -16
  69. package/build/legacy/isPossibleNumber.test.js.map +1 -1
  70. package/build/legacy/isValidNumber.test.js +29 -27
  71. package/build/legacy/isValidNumber.test.js.map +1 -1
  72. package/build/legacy/isValidNumberForRegion.test.js +12 -10
  73. package/build/legacy/isValidNumberForRegion.test.js.map +1 -1
  74. package/build/legacy/parse.test.js +133 -131
  75. package/build/legacy/parse.test.js.map +1 -1
  76. package/build/legacy/searchNumbers.test.js +6 -4
  77. package/build/legacy/searchNumbers.test.js.map +1 -1
  78. package/build/metadata.test.js +61 -59
  79. package/build/metadata.test.js.map +1 -1
  80. package/build/parse.test.js +136 -134
  81. package/build/parse.test.js.map +1 -1
  82. package/build/parseIncompletePhoneNumber.test.js +36 -34
  83. package/build/parseIncompletePhoneNumber.test.js.map +1 -1
  84. package/build/parsePhoneNumber.test.js +39 -37
  85. package/build/parsePhoneNumber.test.js.map +1 -1
  86. package/build/parsePhoneNumberWithError.test.js +52 -50
  87. package/build/parsePhoneNumberWithError.test.js.map +1 -1
  88. package/build/searchPhoneNumbersInText.test.js +13 -11
  89. package/build/searchPhoneNumbersInText.test.js.map +1 -1
  90. package/build/tools/semver-compare.test.js +5 -3
  91. package/build/tools/semver-compare.test.js.map +1 -1
  92. package/build/validatePhoneNumberLength.test.js +14 -12
  93. package/build/validatePhoneNumberLength.test.js.map +1 -1
  94. package/bundle/libphonenumber-js.min.js +1 -1
  95. package/bundle/libphonenumber-js.min.js.map +1 -1
  96. package/bundle/libphonenumber-max.js +1 -1
  97. package/bundle/libphonenumber-max.js.map +1 -1
  98. package/bundle/libphonenumber-min.js +1 -1
  99. package/bundle/libphonenumber-min.js.map +1 -1
  100. package/bundle/libphonenumber-mobile.js +1 -1
  101. package/bundle/libphonenumber-mobile.js.map +1 -1
  102. package/es6/AsYouType.test.js +2 -0
  103. package/es6/AsYouType.test.js.map +1 -1
  104. package/es6/AsYouTypeFormatter.PatternMatcher.test.js +2 -0
  105. package/es6/AsYouTypeFormatter.PatternMatcher.test.js.map +1 -1
  106. package/es6/AsYouTypeFormatter.PatternParser.test.js +2 -0
  107. package/es6/AsYouTypeFormatter.PatternParser.test.js.map +1 -1
  108. package/es6/AsYouTypeFormatter.util.test.js +2 -0
  109. package/es6/AsYouTypeFormatter.util.test.js.map +1 -1
  110. package/es6/PhoneNumber.test.js +2 -0
  111. package/es6/PhoneNumber.test.js.map +1 -1
  112. package/es6/PhoneNumberMatcher.test.js +2 -0
  113. package/es6/PhoneNumberMatcher.test.js.map +1 -1
  114. package/es6/findNumbers/util.test.js +2 -0
  115. package/es6/findNumbers/util.test.js.map +1 -1
  116. package/es6/findPhoneNumbersInText.test.js +2 -0
  117. package/es6/findPhoneNumbersInText.test.js.map +1 -1
  118. package/es6/format.test.js +2 -0
  119. package/es6/format.test.js.map +1 -1
  120. package/es6/formatIncompletePhoneNumber.test.js +2 -0
  121. package/es6/formatIncompletePhoneNumber.test.js.map +1 -1
  122. package/es6/getCountries.test.js +2 -0
  123. package/es6/getCountries.test.js.map +1 -1
  124. package/es6/getCountryCallingCode.test.js +2 -0
  125. package/es6/getCountryCallingCode.test.js.map +1 -1
  126. package/es6/getExampleNumber.test.js +2 -0
  127. package/es6/getExampleNumber.test.js.map +1 -1
  128. package/es6/helpers/RFC3966.test.js +2 -0
  129. package/es6/helpers/RFC3966.test.js.map +1 -1
  130. package/es6/helpers/applyInternationalSeparatorStyle.test.js +2 -0
  131. package/es6/helpers/applyInternationalSeparatorStyle.test.js.map +1 -1
  132. package/es6/helpers/checkNumberLength.test.js +2 -0
  133. package/es6/helpers/checkNumberLength.test.js.map +1 -1
  134. package/es6/helpers/extractCountryCallingCode.test.js +2 -0
  135. package/es6/helpers/extractCountryCallingCode.test.js.map +1 -1
  136. package/es6/helpers/extractNationalNumber.test.js +2 -0
  137. package/es6/helpers/extractNationalNumber.test.js.map +1 -1
  138. package/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.test.js +2 -0
  139. package/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.test.js.map +1 -1
  140. package/es6/helpers/extractPhoneContext.test.js +2 -0
  141. package/es6/helpers/extractPhoneContext.test.js.map +1 -1
  142. package/es6/helpers/getNumberType.test.js +2 -1
  143. package/es6/helpers/getNumberType.test.js.map +1 -1
  144. package/es6/helpers/matchesEntirely.test.js +2 -0
  145. package/es6/helpers/matchesEntirely.test.js.map +1 -1
  146. package/es6/helpers/mergeArrays.test.js +2 -0
  147. package/es6/helpers/mergeArrays.test.js.map +1 -1
  148. package/es6/helpers/parseDigits.test.js +2 -0
  149. package/es6/helpers/parseDigits.test.js.map +1 -1
  150. package/es6/helpers/stripIddPrefix.test.js +2 -0
  151. package/es6/helpers/stripIddPrefix.test.js.map +1 -1
  152. package/es6/isPossible.test.js +2 -0
  153. package/es6/isPossible.test.js.map +1 -1
  154. package/es6/isPossiblePhoneNumber.test.js +2 -0
  155. package/es6/isPossiblePhoneNumber.test.js.map +1 -1
  156. package/es6/isValid.test.js +2 -0
  157. package/es6/isValid.test.js.map +1 -1
  158. package/es6/isValidPhoneNumber.test.js +2 -0
  159. package/es6/isValidPhoneNumber.test.js.map +1 -1
  160. package/es6/legacy/findNumbers.test.js +2 -0
  161. package/es6/legacy/findNumbers.test.js.map +1 -1
  162. package/es6/legacy/findPhoneNumbers.test.js +3 -0
  163. package/es6/legacy/findPhoneNumbers.test.js.map +1 -1
  164. package/es6/legacy/format.test.js +2 -0
  165. package/es6/legacy/format.test.js.map +1 -1
  166. package/es6/legacy/getNumberType.test.js +2 -0
  167. package/es6/legacy/getNumberType.test.js.map +1 -1
  168. package/es6/legacy/isPossibleNumber.test.js +2 -0
  169. package/es6/legacy/isPossibleNumber.test.js.map +1 -1
  170. package/es6/legacy/isValidNumber.test.js +2 -0
  171. package/es6/legacy/isValidNumber.test.js.map +1 -1
  172. package/es6/legacy/isValidNumberForRegion.test.js +2 -0
  173. package/es6/legacy/isValidNumberForRegion.test.js.map +1 -1
  174. package/es6/legacy/parse.test.js +2 -0
  175. package/es6/legacy/parse.test.js.map +1 -1
  176. package/es6/legacy/searchNumbers.test.js +2 -0
  177. package/es6/legacy/searchNumbers.test.js.map +1 -1
  178. package/es6/metadata.test.js +2 -0
  179. package/es6/metadata.test.js.map +1 -1
  180. package/es6/parse.test.js +2 -0
  181. package/es6/parse.test.js.map +1 -1
  182. package/es6/parseIncompletePhoneNumber.test.js +2 -0
  183. package/es6/parseIncompletePhoneNumber.test.js.map +1 -1
  184. package/es6/parsePhoneNumber.test.js +2 -0
  185. package/es6/parsePhoneNumber.test.js.map +1 -1
  186. package/es6/parsePhoneNumberWithError.test.js +2 -0
  187. package/es6/parsePhoneNumberWithError.test.js.map +1 -1
  188. package/es6/searchPhoneNumbersInText.test.js +2 -0
  189. package/es6/searchPhoneNumbersInText.test.js.map +1 -1
  190. package/es6/tools/semver-compare.test.js +2 -0
  191. package/es6/tools/semver-compare.test.js.map +1 -1
  192. package/es6/validatePhoneNumberLength.test.js +2 -0
  193. package/es6/validatePhoneNumberLength.test.js.map +1 -1
  194. package/max/metadata/metadata.max.json +1 -1
  195. package/max/metadata/metadata.max.json.js +1 -1
  196. package/metadata.full.json +1 -1
  197. package/metadata.full.json.js +1 -1
  198. package/metadata.max.json +1 -1
  199. package/metadata.max.json.js +1 -1
  200. package/metadata.min.json +1 -1
  201. package/metadata.min.json.js +1 -1
  202. package/metadata.mobile.json +1 -1
  203. package/metadata.mobile.json.js +1 -1
  204. package/min/metadata/metadata.min.json +1 -1
  205. package/min/metadata/metadata.min.json.js +1 -1
  206. package/mobile/metadata/metadata.mobile.json +1 -1
  207. package/mobile/metadata/metadata.mobile.json.js +1 -1
  208. package/package.json +6 -5
  209. package/source/AsYouType.test.js +3 -0
  210. package/source/AsYouTypeFormatter.PatternMatcher.test.js +3 -0
  211. package/source/AsYouTypeFormatter.PatternParser.test.js +3 -0
  212. package/source/AsYouTypeFormatter.util.test.js +3 -0
  213. package/source/PhoneNumber.test.js +3 -0
  214. package/source/PhoneNumberMatcher.test.js +3 -0
  215. package/source/findNumbers/util.test.js +3 -0
  216. package/source/findPhoneNumbersInText.test.js +3 -0
  217. package/source/format.test.js +3 -0
  218. package/source/formatIncompletePhoneNumber.test.js +3 -0
  219. package/source/getCountries.test.js +3 -0
  220. package/source/getCountryCallingCode.test.js +3 -0
  221. package/source/getExampleNumber.test.js +3 -0
  222. package/source/helpers/RFC3966.test.js +3 -0
  223. package/source/helpers/applyInternationalSeparatorStyle.test.js +3 -0
  224. package/source/helpers/checkNumberLength.test.js +3 -0
  225. package/source/helpers/extractCountryCallingCode.test.js +3 -0
  226. package/source/helpers/extractNationalNumber.test.js +3 -0
  227. package/source/helpers/extractNationalNumberFromPossiblyIncompleteNumber.test.js +3 -0
  228. package/source/helpers/extractPhoneContext.test.js +3 -0
  229. package/source/helpers/getNumberType.test.js +3 -2
  230. package/source/helpers/matchesEntirely.test.js +3 -0
  231. package/source/helpers/mergeArrays.test.js +3 -0
  232. package/source/helpers/parseDigits.test.js +3 -0
  233. package/source/helpers/stripIddPrefix.test.js +3 -0
  234. package/source/isPossible.test.js +3 -0
  235. package/source/isPossiblePhoneNumber.test.js +3 -0
  236. package/source/isValid.test.js +3 -0
  237. package/source/isValidPhoneNumber.test.js +3 -0
  238. package/source/legacy/findNumbers.test.js +3 -0
  239. package/source/legacy/findPhoneNumbers.test.js +3 -0
  240. package/source/legacy/format.test.js +3 -0
  241. package/source/legacy/getNumberType.test.js +3 -0
  242. package/source/legacy/isPossibleNumber.test.js +3 -0
  243. package/source/legacy/isValidNumber.test.js +3 -0
  244. package/source/legacy/isValidNumberForRegion.test.js +3 -0
  245. package/source/legacy/parse.test.js +3 -0
  246. package/source/legacy/searchNumbers.test.js +3 -0
  247. package/source/metadata.test.js +3 -0
  248. package/source/parse.test.js +3 -0
  249. package/source/parseIncompletePhoneNumber.test.js +3 -0
  250. package/source/parsePhoneNumber.test.js +3 -0
  251. package/source/parsePhoneNumberWithError.test.js +3 -0
  252. package/source/searchPhoneNumbersInText.test.js +3 -0
  253. package/source/tools/semver-compare.test.js +3 -0
  254. package/source/validatePhoneNumberLength.test.js +3 -0
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var _mocha = require("mocha");
4
+ var _chai = require("chai");
3
5
  var _metadataMin = _interopRequireDefault(require("../metadata.min.json"));
4
6
  var _AsYouType = _interopRequireDefault(require("./AsYouType.js"));
5
7
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
@@ -25,287 +27,287 @@ var AsYouType = /*#__PURE__*/function (_AsYouType_) {
25
27
  return _createClass(AsYouType);
26
28
  }(_AsYouType["default"]);
27
29
  var USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;
28
- describe('AsYouType', function () {
29
- it('should use "national_prefix_formatting_rule"', function () {
30
+ (0, _mocha.describe)('AsYouType', function () {
31
+ (0, _mocha.it)('should use "national_prefix_formatting_rule"', function () {
30
32
  // With national prefix (full).
31
- expect(new AsYouType('RU').input('88005553535')).to.equal('8 (800) 555-35-35');
33
+ (0, _chai.expect)(new AsYouType('RU').input('88005553535')).to.equal('8 (800) 555-35-35');
32
34
  // With national prefix (partial).
33
- expect(new AsYouType('RU').input('880055535')).to.equal('8 (800) 555-35');
35
+ (0, _chai.expect)(new AsYouType('RU').input('880055535')).to.equal('8 (800) 555-35');
34
36
  });
35
- it('should populate national number template (digit by digit)', function () {
37
+ (0, _mocha.it)('should populate national number template (digit by digit)', function () {
36
38
  var formatter = new AsYouType('US');
37
39
  formatter.input('1');
38
40
  // formatter.formatter.template.should.equal('x (xxx) xxx-xxxx')
39
- expect(formatter.formatter.template).to.equal('x xxx-xxxx');
41
+ (0, _chai.expect)(formatter.formatter.template).to.equal('x xxx-xxxx');
40
42
  // formatter.formatter.populatedNationalNumberTemplate.should.equal('1 (xxx) xxx-xxxx')
41
- expect(formatter.formatter.populatedNationalNumberTemplate).to.equal('1 xxx-xxxx');
43
+ (0, _chai.expect)(formatter.formatter.populatedNationalNumberTemplate).to.equal('1 xxx-xxxx');
42
44
  formatter.input('213');
43
- expect(formatter.formatter.populatedNationalNumberTemplate).to.equal('1 (213) xxx-xxxx');
45
+ (0, _chai.expect)(formatter.formatter.populatedNationalNumberTemplate).to.equal('1 (213) xxx-xxxx');
44
46
  formatter.input('3734253');
45
- expect(formatter.formatter.populatedNationalNumberTemplate).to.equal('1 (213) 373-4253');
47
+ (0, _chai.expect)(formatter.formatter.populatedNationalNumberTemplate).to.equal('1 (213) 373-4253');
46
48
  });
47
- it('should populate international number template (digit by digit) (default country)', function () {
49
+ (0, _mocha.it)('should populate international number template (digit by digit) (default country)', function () {
48
50
  var formatter = new AsYouType('US');
49
- expect(formatter.formatter.template).to.be.undefined;
50
- expect(formatter.formatter.populatedNationalNumberTemplate).to.be.undefined;
51
- expect(formatter.input('')).to.equal('');
52
- expect(formatter.formatter.template).to.be.undefined;
53
- expect(formatter.formatter.populatedNationalNumberTemplate).to.be.undefined;
54
- expect(formatter.input('+')).to.equal('+');
55
- expect(formatter.getTemplate()).to.equal('x');
56
- expect(formatter.formatter.template).to.be.undefined;
57
- expect(formatter.formatter.populatedNationalNumberTemplate).to.be.undefined;
58
- expect(formatter.input('1')).to.equal('+1');
59
- expect(formatter.getTemplate()).to.equal('xx');
51
+ (0, _chai.expect)(formatter.formatter.template).to.be.undefined;
52
+ (0, _chai.expect)(formatter.formatter.populatedNationalNumberTemplate).to.be.undefined;
53
+ (0, _chai.expect)(formatter.input('')).to.equal('');
54
+ (0, _chai.expect)(formatter.formatter.template).to.be.undefined;
55
+ (0, _chai.expect)(formatter.formatter.populatedNationalNumberTemplate).to.be.undefined;
56
+ (0, _chai.expect)(formatter.input('+')).to.equal('+');
57
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('x');
58
+ (0, _chai.expect)(formatter.formatter.template).to.be.undefined;
59
+ (0, _chai.expect)(formatter.formatter.populatedNationalNumberTemplate).to.be.undefined;
60
+ (0, _chai.expect)(formatter.input('1')).to.equal('+1');
61
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('xx');
60
62
  // Hasn't started formatting the phone number using the template yet.
61
63
  // formatter.formatter.template.should.equal('xx xxx xxx xxxx')
62
- expect(formatter.formatter.template).to.equal('xx xxx xxxx');
64
+ (0, _chai.expect)(formatter.formatter.template).to.equal('xx xxx xxxx');
63
65
  // formatter.formatter.populatedNationalNumberTemplate.should.equal('xxx xxx xxxx')
64
- expect(formatter.formatter.populatedNationalNumberTemplate).to.equal('xxx xxxx');
66
+ (0, _chai.expect)(formatter.formatter.populatedNationalNumberTemplate).to.equal('xxx xxxx');
65
67
  // Has some national number digits, starts formatting the phone number using the template.
66
68
  formatter.input('213');
67
- expect(formatter.formatter.populatedNationalNumberTemplate).to.equal('213 xxx xxxx');
69
+ (0, _chai.expect)(formatter.formatter.populatedNationalNumberTemplate).to.equal('213 xxx xxxx');
68
70
  formatter.input('3734253');
69
- expect(formatter.formatter.populatedNationalNumberTemplate).to.equal('213 373 4253');
71
+ (0, _chai.expect)(formatter.formatter.populatedNationalNumberTemplate).to.equal('213 373 4253');
70
72
  });
71
- it('should populate international number template (digit by digit)', function () {
73
+ (0, _mocha.it)('should populate international number template (digit by digit)', function () {
72
74
  var formatter = new AsYouType();
73
- expect(formatter.formatter.template).to.be.undefined;
74
- expect(formatter.formatter.populatedNationalNumberTemplate).to.be.undefined;
75
- expect(formatter.input('')).to.equal('');
76
- expect(formatter.formatter.template).to.be.undefined;
77
- expect(formatter.formatter.populatedNationalNumberTemplate).to.be.undefined;
78
- expect(formatter.input('+')).to.equal('+');
79
- expect(formatter.formatter.template).to.be.undefined;
80
- expect(formatter.formatter.populatedNationalNumberTemplate).to.be.undefined;
81
- expect(formatter.input('1')).to.equal('+1');
75
+ (0, _chai.expect)(formatter.formatter.template).to.be.undefined;
76
+ (0, _chai.expect)(formatter.formatter.populatedNationalNumberTemplate).to.be.undefined;
77
+ (0, _chai.expect)(formatter.input('')).to.equal('');
78
+ (0, _chai.expect)(formatter.formatter.template).to.be.undefined;
79
+ (0, _chai.expect)(formatter.formatter.populatedNationalNumberTemplate).to.be.undefined;
80
+ (0, _chai.expect)(formatter.input('+')).to.equal('+');
81
+ (0, _chai.expect)(formatter.formatter.template).to.be.undefined;
82
+ (0, _chai.expect)(formatter.formatter.populatedNationalNumberTemplate).to.be.undefined;
83
+ (0, _chai.expect)(formatter.input('1')).to.equal('+1');
82
84
  // formatter.formatter.template.should.equal('xx xxx xxx xxxx')
83
- expect(formatter.formatter.template).to.equal('xx xxx xxxx');
85
+ (0, _chai.expect)(formatter.formatter.template).to.equal('xx xxx xxxx');
84
86
  // Hasn't yet started formatting the phone number using the template.
85
87
  // formatter.formatter.populatedNationalNumberTemplate.should.equal('xxx xxx xxxx')
86
- expect(formatter.formatter.populatedNationalNumberTemplate).to.equal('xxx xxxx');
88
+ (0, _chai.expect)(formatter.formatter.populatedNationalNumberTemplate).to.equal('xxx xxxx');
87
89
  // Has some national number digits, starts formatting the phone number using the template.
88
90
  formatter.input('213');
89
- expect(formatter.formatter.populatedNationalNumberTemplate).to.equal('213 xxx xxxx');
91
+ (0, _chai.expect)(formatter.formatter.populatedNationalNumberTemplate).to.equal('213 xxx xxxx');
90
92
  formatter.input('3734253');
91
- expect(formatter.formatter.populatedNationalNumberTemplate).to.equal('213 373 4253');
93
+ (0, _chai.expect)(formatter.formatter.populatedNationalNumberTemplate).to.equal('213 373 4253');
92
94
  });
93
- it('should populate national number template (attempt to format complete number)', function () {
95
+ (0, _mocha.it)('should populate national number template (attempt to format complete number)', function () {
94
96
  var formatter = new AsYouType('US');
95
- expect(formatter.input('12133734253')).to.equal('1 (213) 373-4253');
96
- expect(formatter.formatter.template).to.equal('x (xxx) xxx-xxxx');
97
- expect(formatter.formatter.populatedNationalNumberTemplate).to.equal('1 (213) 373-4253');
97
+ (0, _chai.expect)(formatter.input('12133734253')).to.equal('1 (213) 373-4253');
98
+ (0, _chai.expect)(formatter.formatter.template).to.equal('x (xxx) xxx-xxxx');
99
+ (0, _chai.expect)(formatter.formatter.populatedNationalNumberTemplate).to.equal('1 (213) 373-4253');
98
100
  });
99
- it('should parse and format phone numbers as you type', function () {
101
+ (0, _mocha.it)('should parse and format phone numbers as you type', function () {
100
102
  // International number test
101
- expect(new AsYouType().input('+12133734')).to.equal('+1 213 373 4');
103
+ (0, _chai.expect)(new AsYouType().input('+12133734')).to.equal('+1 213 373 4');
102
104
  // Local number test
103
- expect(new AsYouType('US').input('2133734')).to.equal('(213) 373-4');
105
+ (0, _chai.expect)(new AsYouType('US').input('2133734')).to.equal('(213) 373-4');
104
106
 
105
107
  // US national number retains national prefix.
106
- expect(new AsYouType('US').input('12133734')).to.equal('1 (213) 373-4');
108
+ (0, _chai.expect)(new AsYouType('US').input('12133734')).to.equal('1 (213) 373-4');
107
109
 
108
110
  // US national number retains national prefix (full number).
109
- expect(new AsYouType('US').input('12133734253')).to.equal('1 (213) 373-4253');
111
+ (0, _chai.expect)(new AsYouType('US').input('12133734253')).to.equal('1 (213) 373-4253');
110
112
  var formatter;
111
113
 
112
114
  // // Should discard national prefix from a "complete" phone number.
113
115
  // new AsYouType('RU').input('8800555353').should.equal('880 055-53-53')
114
116
 
115
117
  // Shouldn't extract national prefix when inputting in international format.
116
- expect(new AsYouType('RU').input('+7800555353')).to.equal('+7 800 555 35 3');
117
- expect(new AsYouType('CH').input('044-668-1')).to.equal('044 668 1');
118
+ (0, _chai.expect)(new AsYouType('RU').input('+7800555353')).to.equal('+7 800 555 35 3');
119
+ (0, _chai.expect)(new AsYouType('CH').input('044-668-1')).to.equal('044 668 1');
118
120
 
119
121
  // Test International phone number (international)
120
122
 
121
123
  formatter = new AsYouType();
122
124
 
123
125
  // formatter.valid.should.be.false
124
- expect(type(formatter.getCountry())).to.equal('undefined');
125
- expect(type(formatter.getCountryCallingCode())).to.equal('undefined');
126
- expect(formatter.getTemplate()).to.equal('');
127
- expect(formatter.input('+')).to.equal('+');
126
+ (0, _chai.expect)(type(formatter.getCountry())).to.equal('undefined');
127
+ (0, _chai.expect)(type(formatter.getCountryCallingCode())).to.equal('undefined');
128
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('');
129
+ (0, _chai.expect)(formatter.input('+')).to.equal('+');
128
130
 
129
131
  // formatter.valid.should.be.false
130
- expect(type(formatter.getCountry())).to.equal('undefined');
131
- expect(type(formatter.getCountryCallingCode())).to.equal('undefined');
132
- expect(formatter.getTemplate()).to.equal('x');
133
- expect(formatter.input('1')).to.equal('+1');
132
+ (0, _chai.expect)(type(formatter.getCountry())).to.equal('undefined');
133
+ (0, _chai.expect)(type(formatter.getCountryCallingCode())).to.equal('undefined');
134
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('x');
135
+ (0, _chai.expect)(formatter.input('1')).to.equal('+1');
134
136
 
135
137
  // formatter.valid.should.be.false
136
- expect(type(formatter.getCountry())).to.equal('undefined');
137
- expect(formatter.getCountryCallingCode()).to.equal('1');
138
- expect(formatter.getTemplate()).to.equal('xx');
139
- expect(formatter.input('2')).to.equal('+1 2');
140
- expect(formatter.getTemplate()).to.equal('xx x');
138
+ (0, _chai.expect)(type(formatter.getCountry())).to.equal('undefined');
139
+ (0, _chai.expect)(formatter.getCountryCallingCode()).to.equal('1');
140
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('xx');
141
+ (0, _chai.expect)(formatter.input('2')).to.equal('+1 2');
142
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('xx x');
141
143
 
142
144
  // formatter.valid.should.be.false
143
- expect(type(formatter.getCountry())).to.equal('undefined');
144
- expect(formatter.input('1')).to.equal('+1 21');
145
- expect(formatter.input('3')).to.equal('+1 213');
146
- expect(formatter.input(' ')).to.equal('+1 213');
147
- expect(formatter.input('3')).to.equal('+1 213 3');
148
- expect(formatter.input('3')).to.equal('+1 213 33');
149
- expect(formatter.input('3')).to.equal('+1 213 333');
150
- expect(formatter.input('4')).to.equal('+1 213 333 4');
151
- expect(formatter.input('4')).to.equal('+1 213 333 44');
152
- expect(formatter.input('4')).to.equal('+1 213 333 444');
145
+ (0, _chai.expect)(type(formatter.getCountry())).to.equal('undefined');
146
+ (0, _chai.expect)(formatter.input('1')).to.equal('+1 21');
147
+ (0, _chai.expect)(formatter.input('3')).to.equal('+1 213');
148
+ (0, _chai.expect)(formatter.input(' ')).to.equal('+1 213');
149
+ (0, _chai.expect)(formatter.input('3')).to.equal('+1 213 3');
150
+ (0, _chai.expect)(formatter.input('3')).to.equal('+1 213 33');
151
+ (0, _chai.expect)(formatter.input('3')).to.equal('+1 213 333');
152
+ (0, _chai.expect)(formatter.input('4')).to.equal('+1 213 333 4');
153
+ (0, _chai.expect)(formatter.input('4')).to.equal('+1 213 333 44');
154
+ (0, _chai.expect)(formatter.input('4')).to.equal('+1 213 333 444');
153
155
 
154
156
  // formatter.valid.should.be.false
155
- expect(type(formatter.getCountry())).to.equal('undefined');
156
- expect(formatter.input('4')).to.equal('+1 213 333 4444');
157
+ (0, _chai.expect)(type(formatter.getCountry())).to.equal('undefined');
158
+ (0, _chai.expect)(formatter.input('4')).to.equal('+1 213 333 4444');
157
159
 
158
160
  // formatter.valid.should.be.true
159
- expect(formatter.getCountry()).to.equal('US');
161
+ (0, _chai.expect)(formatter.getCountry()).to.equal('US');
160
162
  // This one below contains "punctuation spaces"
161
163
  // along with the regular spaces
162
- expect(formatter.getTemplate()).to.equal('xx xxx xxx xxxx');
163
- expect(formatter.input('5')).to.equal('+1 21333344445');
164
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('xx xxx xxx xxxx');
165
+ (0, _chai.expect)(formatter.input('5')).to.equal('+1 21333344445');
164
166
 
165
167
  // formatter.valid.should.be.false
166
- expect(formatter.getCountry()).to.be.undefined;
167
- expect(formatter.getCountryCallingCode()).to.equal('1');
168
- expect(formatter.formatter.template).to.be.undefined;
168
+ (0, _chai.expect)(formatter.getCountry()).to.be.undefined;
169
+ (0, _chai.expect)(formatter.getCountryCallingCode()).to.equal('1');
170
+ (0, _chai.expect)(formatter.formatter.template).to.be.undefined;
169
171
 
170
172
  // Check that clearing an international formatter
171
173
  // also clears country metadata.
172
174
 
173
175
  formatter.reset();
174
- expect(formatter.input('+')).to.equal('+');
175
- expect(formatter.input('7')).to.equal('+7');
176
- expect(formatter.input('9')).to.equal('+7 9');
177
- expect(formatter.input('99 111 22 33')).to.equal('+7 999 111 22 33');
176
+ (0, _chai.expect)(formatter.input('+')).to.equal('+');
177
+ (0, _chai.expect)(formatter.input('7')).to.equal('+7');
178
+ (0, _chai.expect)(formatter.input('9')).to.equal('+7 9');
179
+ (0, _chai.expect)(formatter.input('99 111 22 33')).to.equal('+7 999 111 22 33');
178
180
 
179
181
  // Test Switzerland phone numbers
180
182
 
181
183
  formatter = new AsYouType('CH');
182
- expect(formatter.input(' ')).to.equal('');
183
- expect(formatter.input('0')).to.equal('0');
184
- expect(formatter.input('4')).to.equal('04');
185
- expect(formatter.input(' ')).to.equal('04');
186
- expect(formatter.input('-')).to.equal('04');
187
- expect(formatter.input('4')).to.equal('044');
188
- expect(formatter.input('-')).to.equal('044');
189
- expect(formatter.input('6')).to.equal('044 6');
190
- expect(formatter.input('6')).to.equal('044 66');
191
- expect(formatter.input('8')).to.equal('044 668');
192
- expect(formatter.input('-')).to.equal('044 668');
193
- expect(formatter.input('1')).to.equal('044 668 1');
194
- expect(formatter.input('8')).to.equal('044 668 18');
184
+ (0, _chai.expect)(formatter.input(' ')).to.equal('');
185
+ (0, _chai.expect)(formatter.input('0')).to.equal('0');
186
+ (0, _chai.expect)(formatter.input('4')).to.equal('04');
187
+ (0, _chai.expect)(formatter.input(' ')).to.equal('04');
188
+ (0, _chai.expect)(formatter.input('-')).to.equal('04');
189
+ (0, _chai.expect)(formatter.input('4')).to.equal('044');
190
+ (0, _chai.expect)(formatter.input('-')).to.equal('044');
191
+ (0, _chai.expect)(formatter.input('6')).to.equal('044 6');
192
+ (0, _chai.expect)(formatter.input('6')).to.equal('044 66');
193
+ (0, _chai.expect)(formatter.input('8')).to.equal('044 668');
194
+ (0, _chai.expect)(formatter.input('-')).to.equal('044 668');
195
+ (0, _chai.expect)(formatter.input('1')).to.equal('044 668 1');
196
+ (0, _chai.expect)(formatter.input('8')).to.equal('044 668 18');
195
197
 
196
198
  // formatter.valid.should.be.false
197
- expect(formatter.getCountry()).to.equal('CH');
198
- expect(formatter.formatter.template).to.equal('xxx xxx xx xx');
199
- expect(formatter.getTemplate()).to.equal('xxx xxx xx');
200
- expect(formatter.input(' 00')).to.equal('044 668 18 00');
199
+ (0, _chai.expect)(formatter.getCountry()).to.equal('CH');
200
+ (0, _chai.expect)(formatter.formatter.template).to.equal('xxx xxx xx xx');
201
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('xxx xxx xx');
202
+ (0, _chai.expect)(formatter.input(' 00')).to.equal('044 668 18 00');
201
203
 
202
204
  // formatter.valid.should.be.true
203
- expect(formatter.getCountry()).to.equal('CH');
204
- expect(formatter.getTemplate()).to.equal('xxx xxx xx xx');
205
- expect(formatter.input('9')).to.equal('04466818009');
205
+ (0, _chai.expect)(formatter.getCountry()).to.equal('CH');
206
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('xxx xxx xx xx');
207
+ (0, _chai.expect)(formatter.input('9')).to.equal('04466818009');
206
208
 
207
209
  // formatter.valid.should.be.false
208
- expect(formatter.getCountry()).to.equal('CH');
209
- expect(formatter.formatter.template).to.be.undefined;
210
+ (0, _chai.expect)(formatter.getCountry()).to.equal('CH');
211
+ (0, _chai.expect)(formatter.formatter.template).to.be.undefined;
210
212
 
211
213
  // Kazakhstan (non-main country for +7 country phone code)
212
214
 
213
215
  formatter = new AsYouType();
214
216
  formatter.input('+77172580659');
215
- expect(formatter.getCountry()).to.equal('KZ');
217
+ (0, _chai.expect)(formatter.getCountry()).to.equal('KZ');
216
218
 
217
219
  // Brazil
218
220
 
219
221
  formatter = new AsYouType('BR');
220
- expect(formatter.input('11987654321')).to.equal('(11) 98765-4321');
222
+ (0, _chai.expect)(formatter.input('11987654321')).to.equal('(11) 98765-4321');
221
223
 
222
224
  // UK (Jersey) (non-main country for +44 country phone code)
223
225
 
224
226
  formatter = new AsYouType();
225
- expect(formatter.input('+447700300000')).to.equal('+44 7700 300000');
226
- expect(formatter.getTemplate()).to.equal('xxx xxxx xxxxxx');
227
- expect(formatter.getCountry()).to.equal('JE');
227
+ (0, _chai.expect)(formatter.input('+447700300000')).to.equal('+44 7700 300000');
228
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('xxx xxxx xxxxxx');
229
+ (0, _chai.expect)(formatter.getCountry()).to.equal('JE');
228
230
 
229
231
  // Braces must be part of the template.
230
232
  formatter = new AsYouType('RU');
231
- expect(formatter.input('88005553535')).to.equal('8 (800) 555-35-35');
232
- expect(formatter.getTemplate()).to.equal('x (xxx) xxx-xx-xx');
233
+ (0, _chai.expect)(formatter.input('88005553535')).to.equal('8 (800) 555-35-35');
234
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('x (xxx) xxx-xx-xx');
233
235
 
234
236
  // Test Russian phone numbers
235
237
  // (with optional national prefix `8`)
236
238
 
237
239
  formatter = new AsYouType('RU');
238
- expect(formatter.input('8')).to.equal('8');
239
- expect(formatter.input('9')).to.equal('8 9');
240
- expect(formatter.input('9')).to.equal('8 99');
241
- expect(formatter.input('9')).to.equal('8 (999)');
242
- expect(formatter.input('-')).to.equal('8 (999)');
243
- expect(formatter.input('1234')).to.equal('8 (999) 123-4');
244
- expect(formatter.input('567')).to.equal('8 (999) 123-45-67');
245
- expect(formatter.input('8')).to.equal('899912345678');
240
+ (0, _chai.expect)(formatter.input('8')).to.equal('8');
241
+ (0, _chai.expect)(formatter.input('9')).to.equal('8 9');
242
+ (0, _chai.expect)(formatter.input('9')).to.equal('8 99');
243
+ (0, _chai.expect)(formatter.input('9')).to.equal('8 (999)');
244
+ (0, _chai.expect)(formatter.input('-')).to.equal('8 (999)');
245
+ (0, _chai.expect)(formatter.input('1234')).to.equal('8 (999) 123-4');
246
+ (0, _chai.expect)(formatter.input('567')).to.equal('8 (999) 123-45-67');
247
+ (0, _chai.expect)(formatter.input('8')).to.equal('899912345678');
246
248
 
247
249
  // Shouldn't strip national prefix if it is optional
248
250
  // and if it's a valid phone number (international).
249
251
  formatter = new AsYouType('RU');
250
252
  // formatter.input('8005553535').should.equal('(800) 555-35-35')
251
- expect(formatter.input('+78005553535')).to.equal('+7 800 555 35 35');
252
- expect(formatter.getNationalNumber()).to.equal('8005553535');
253
+ (0, _chai.expect)(formatter.input('+78005553535')).to.equal('+7 800 555 35 35');
254
+ (0, _chai.expect)(formatter.getNationalNumber()).to.equal('8005553535');
253
255
 
254
256
  // Check that clearing an national formatter:
255
257
  // * doesn't clear country metadata
256
258
  // * clears all other things
257
259
 
258
260
  formatter.reset();
259
- expect(formatter.input('8')).to.equal('8');
260
- expect(formatter.input('9')).to.equal('8 9');
261
- expect(formatter.input('9')).to.equal('8 99');
262
- expect(formatter.input('9')).to.equal('8 (999)');
263
- expect(formatter.input('-')).to.equal('8 (999)');
264
- expect(formatter.input('1234')).to.equal('8 (999) 123-4');
265
- expect(formatter.input('567')).to.equal('8 (999) 123-45-67');
266
- expect(formatter.input('8')).to.equal('899912345678');
261
+ (0, _chai.expect)(formatter.input('8')).to.equal('8');
262
+ (0, _chai.expect)(formatter.input('9')).to.equal('8 9');
263
+ (0, _chai.expect)(formatter.input('9')).to.equal('8 99');
264
+ (0, _chai.expect)(formatter.input('9')).to.equal('8 (999)');
265
+ (0, _chai.expect)(formatter.input('-')).to.equal('8 (999)');
266
+ (0, _chai.expect)(formatter.input('1234')).to.equal('8 (999) 123-4');
267
+ (0, _chai.expect)(formatter.input('567')).to.equal('8 (999) 123-45-67');
268
+ (0, _chai.expect)(formatter.input('8')).to.equal('899912345678');
267
269
 
268
270
  // National prefix should not be prepended
269
271
  // when formatting local NANPA phone numbers.
270
- expect(new AsYouType('US').input('1')).to.equal('1');
271
- expect(new AsYouType('US').input('12')).to.equal('1 2');
272
- expect(new AsYouType('US').input('123')).to.equal('1 23');
272
+ (0, _chai.expect)(new AsYouType('US').input('1')).to.equal('1');
273
+ (0, _chai.expect)(new AsYouType('US').input('12')).to.equal('1 2');
274
+ (0, _chai.expect)(new AsYouType('US').input('123')).to.equal('1 23');
273
275
 
274
276
  // Bulgaria
275
277
  // (should not prepend national prefix `0`)
276
- expect(new AsYouType('BG').input('111 222 3')).to.equal('1112223');
278
+ (0, _chai.expect)(new AsYouType('BG').input('111 222 3')).to.equal('1112223');
277
279
 
278
280
  // Deutchland
279
- expect(new AsYouType().input('+4915539898001')).to.equal('+49 15539 898001');
281
+ (0, _chai.expect)(new AsYouType().input('+4915539898001')).to.equal('+49 15539 898001');
280
282
 
281
283
  // KZ detection
282
284
  formatter = new AsYouType();
283
285
  formatter.input('+7 702 211 1111');
284
- expect(formatter.getCountry()).to.equal('KZ');
286
+ (0, _chai.expect)(formatter.getCountry()).to.equal('KZ');
285
287
  // formatter.valid.should.equal(true)
286
288
 
287
289
  // New Zealand formatting fix (issue #89)
288
- expect(new AsYouType('NZ').input('0212')).to.equal('021 2');
290
+ (0, _chai.expect)(new AsYouType('NZ').input('0212')).to.equal('021 2');
289
291
 
290
292
  // South Korea
291
293
  formatter = new AsYouType();
292
- expect(formatter.input('+82111111111')).to.equal('+82 11 111 1111');
293
- expect(formatter.getTemplate()).to.equal('xxx xx xxx xxxx');
294
+ (0, _chai.expect)(formatter.input('+82111111111')).to.equal('+82 11 111 1111');
295
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('xxx xx xxx xxxx');
294
296
  });
295
- it('should filter out formats that require a national prefix and no national prefix has been input', function () {
297
+ (0, _mocha.it)('should filter out formats that require a national prefix and no national prefix has been input', function () {
296
298
  // Afghanistan.
297
299
  var formatter = new AsYouType('AF');
298
300
 
299
301
  // No national prefix, and national prefix is required in the format.
300
302
  // (not `"national_prefix_is_optional_when_formatting": true`)
301
- expect(formatter.input('44444444')).to.equal('44444444');
302
- expect(formatter.formatter.template).to.be.undefined;
303
+ (0, _chai.expect)(formatter.input('44444444')).to.equal('44444444');
304
+ (0, _chai.expect)(formatter.formatter.template).to.be.undefined;
303
305
 
304
306
  // With national prefix
305
- expect(formatter.reset().input('044444444')).to.equal('044 444 444');
306
- expect(formatter.formatter.template).to.equal('xxx xxx xxxx');
307
+ (0, _chai.expect)(formatter.reset().input('044444444')).to.equal('044 444 444');
308
+ (0, _chai.expect)(formatter.formatter.template).to.equal('xxx xxx xxxx');
307
309
  });
308
- it('should work when a digit is not a national prefix but a part of a valid national number', function () {
310
+ (0, _mocha.it)('should work when a digit is not a national prefix but a part of a valid national number', function () {
309
311
  // In Russia, `8` could be both a valid national prefix
310
312
  // and a part of a valid national number.
311
313
  var formatter = new AsYouType('RU');
@@ -324,38 +326,38 @@ describe('AsYouType', function () {
324
326
  // in Russia, people are used to inputting `800` numbers with national prefix `8`:
325
327
  // `8 800 555 35 35`.
326
328
  // formatter.input('8005553535').should.equal('(800) 555-35-35')
327
- expect(formatter.input('8005553535')).to.equal('8005553535');
329
+ (0, _chai.expect)(formatter.input('8005553535')).to.equal('8005553535');
328
330
  formatter.reset();
329
- expect(formatter.input('+78005553535')).to.equal('+7 800 555 35 35');
331
+ (0, _chai.expect)(formatter.input('+78005553535')).to.equal('+7 800 555 35 35');
330
332
  });
331
- it('should match formats that require a national prefix and no national prefix has been input (national prefix is mandatory for a format)', function () {
333
+ (0, _mocha.it)('should match formats that require a national prefix and no national prefix has been input (national prefix is mandatory for a format)', function () {
332
334
  var formatter = new AsYouType('FR');
333
- expect(formatter.input('612345678')).to.equal('612345678');
335
+ (0, _chai.expect)(formatter.input('612345678')).to.equal('612345678');
334
336
  formatter.reset();
335
- expect(formatter.input('0612345678')).to.equal('06 12 34 56 78');
337
+ (0, _chai.expect)(formatter.input('0612345678')).to.equal('06 12 34 56 78');
336
338
  });
337
- it('should match formats that require a national prefix and no national prefix has been input (national prefix is not mandatory for a format)', function () {
339
+ (0, _mocha.it)('should match formats that require a national prefix and no national prefix has been input (national prefix is not mandatory for a format)', function () {
338
340
  var formatter = new AsYouType('RU');
339
341
  // Without national prefix.
340
- expect(formatter.input('9991234567')).to.equal('999 123-45-67');
342
+ (0, _chai.expect)(formatter.input('9991234567')).to.equal('999 123-45-67');
341
343
  formatter.reset();
342
344
  // With national prefix.
343
- expect(formatter.input('89991234567')).to.equal('8 (999) 123-45-67');
345
+ (0, _chai.expect)(formatter.input('89991234567')).to.equal('8 (999) 123-45-67');
344
346
  });
345
- it('should not use `national_prefix_formatting_rule` when formatting international phone numbers', function () {
347
+ (0, _mocha.it)('should not use `national_prefix_formatting_rule` when formatting international phone numbers', function () {
346
348
  // Brazil.
347
349
  // `national_prefix_formatting_rule` is `($1)`.
348
350
  // Should not add braces around `12` when being input in international format.
349
- expect(new AsYouType().input('+55123456789')).to.equal('+55 12 3456 789');
350
- expect(new AsYouType('BR').input('+55123456789')).to.equal('+55 12 3456 789');
351
- expect(new AsYouType('BR').input('123456789')).to.equal('(12) 3456-789');
351
+ (0, _chai.expect)(new AsYouType().input('+55123456789')).to.equal('+55 12 3456 789');
352
+ (0, _chai.expect)(new AsYouType('BR').input('+55123456789')).to.equal('+55 12 3456 789');
353
+ (0, _chai.expect)(new AsYouType('BR').input('123456789')).to.equal('(12) 3456-789');
352
354
  });
353
- it('should support incorrectly entered international phone numbers (with a national prefix)', function () {
355
+ (0, _mocha.it)('should support incorrectly entered international phone numbers (with a national prefix)', function () {
354
356
  var formatter;
355
357
  formatter = new AsYouType();
356
- expect(formatter.input('+1 1 877 215 5230')).to.equal('+1 1 877 215 5230');
358
+ (0, _chai.expect)(formatter.input('+1 1 877 215 5230')).to.equal('+1 1 877 215 5230');
357
359
  // formatter.input('+1 1 877 215 5230').should.equal('+1 1 8772155230')
358
- expect(formatter.getNationalNumber()).to.equal('8772155230');
360
+ (0, _chai.expect)(formatter.getNationalNumber()).to.equal('8772155230');
359
361
 
360
362
  // They've added another number format that has `8` leading digit
361
363
  // and 14 digits. Maybe it's something related to Kazakhstan.
@@ -364,53 +366,53 @@ describe('AsYouType', function () {
364
366
  // formatter.input('5').should.equal('+7 8 800 555 35 35')
365
367
  // formatter.getNationalNumber().should.equal('8005553535')
366
368
  });
367
- it('should return a partial template for current value', function () {
369
+ (0, _mocha.it)('should return a partial template for current value', function () {
368
370
  var asYouType = new AsYouType('US');
369
- expect(asYouType.input('')).to.equal('');
370
- expect(asYouType.getTemplate()).to.equal('');
371
- expect(asYouType.input('2')).to.equal('2');
371
+ (0, _chai.expect)(asYouType.input('')).to.equal('');
372
+ (0, _chai.expect)(asYouType.getTemplate()).to.equal('');
373
+ (0, _chai.expect)(asYouType.input('2')).to.equal('2');
372
374
  // asYouType.getTemplate().should.equal('x')
373
375
  // Doesn't format for a single digit.
374
- expect(asYouType.getTemplate()).to.equal('x');
375
- expect(asYouType.input('1')).to.equal('21');
376
- expect(asYouType.getTemplate()).to.equal('xx');
377
- expect(asYouType.input('3')).to.equal('(213)');
378
- expect(asYouType.getTemplate()).to.equal('(xxx)');
376
+ (0, _chai.expect)(asYouType.getTemplate()).to.equal('x');
377
+ (0, _chai.expect)(asYouType.input('1')).to.equal('21');
378
+ (0, _chai.expect)(asYouType.getTemplate()).to.equal('xx');
379
+ (0, _chai.expect)(asYouType.input('3')).to.equal('(213)');
380
+ (0, _chai.expect)(asYouType.getTemplate()).to.equal('(xxx)');
379
381
  });
380
- it("should fall back to the default country", function () {
382
+ (0, _mocha.it)("should fall back to the default country", function () {
381
383
  var formatter = new AsYouType('RU');
382
- expect(formatter.input('8')).to.equal('8');
383
- expect(formatter.input('9')).to.equal('8 9');
384
- expect(formatter.input('9')).to.equal('8 99');
385
- expect(formatter.input('9')).to.equal('8 (999)');
384
+ (0, _chai.expect)(formatter.input('8')).to.equal('8');
385
+ (0, _chai.expect)(formatter.input('9')).to.equal('8 9');
386
+ (0, _chai.expect)(formatter.input('9')).to.equal('8 99');
387
+ (0, _chai.expect)(formatter.input('9')).to.equal('8 (999)');
386
388
 
387
389
  // formatter.valid.should.be.false
388
- expect(formatter.formatter.template).to.equal('x (xxx) xxx-xx-xx');
389
- expect(formatter.getCountry()).to.equal('RU');
390
+ (0, _chai.expect)(formatter.formatter.template).to.equal('x (xxx) xxx-xx-xx');
391
+ (0, _chai.expect)(formatter.getCountry()).to.equal('RU');
390
392
  // formatter.getCountryCallingCode().should.equal('7')
391
393
 
392
- expect(formatter.input('000000000000')).to.equal('8999000000000000');
394
+ (0, _chai.expect)(formatter.input('000000000000')).to.equal('8999000000000000');
393
395
 
394
396
  // formatter.valid.should.be.false
395
- expect(formatter.formatter.template).to.be.undefined;
396
- expect(formatter.getCountry()).to.equal('RU');
397
+ (0, _chai.expect)(formatter.formatter.template).to.be.undefined;
398
+ (0, _chai.expect)(formatter.getCountry()).to.equal('RU');
397
399
  // formatter.getCountryCallingCode().should.equal('7')
398
400
 
399
401
  formatter.reset();
400
402
 
401
403
  // formatter.valid.should.be.false
402
- expect(formatter.formatter.template).to.be.undefined;
403
- expect(formatter.getCountry()).to.be.undefined;
404
+ (0, _chai.expect)(formatter.formatter.template).to.be.undefined;
405
+ (0, _chai.expect)(formatter.getCountry()).to.be.undefined;
404
406
  // formatter.getCountryCallingCode().should.equal('7')
405
407
 
406
- expect(formatter.input('+1-213-373-4253')).to.equal('+1 213 373 4253');
408
+ (0, _chai.expect)(formatter.input('+1-213-373-4253')).to.equal('+1 213 373 4253');
407
409
 
408
410
  // formatter.valid.should.be.true
409
- expect(formatter.getTemplate()).to.equal('xx xxx xxx xxxx');
410
- expect(formatter.getCountry()).to.equal('US');
411
- expect(formatter.getCountryCallingCode()).to.equal('1');
411
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('xx xxx xxx xxxx');
412
+ (0, _chai.expect)(formatter.getCountry()).to.equal('US');
413
+ (0, _chai.expect)(formatter.getCountryCallingCode()).to.equal('1');
412
414
  });
413
- it('should work in edge cases', function () {
415
+ (0, _mocha.it)('should work in edge cases', function () {
414
416
  var formatter;
415
417
  var thrower;
416
418
 
@@ -418,72 +420,72 @@ describe('AsYouType', function () {
418
420
  thrower = function thrower() {
419
421
  return new _AsYouType["default"]('RU');
420
422
  };
421
- expect(thrower).to["throw"]('`metadata` argument not passed');
423
+ (0, _chai.expect)(thrower).to["throw"]('`metadata` argument not passed');
422
424
 
423
425
  // Second '+' sign
424
426
 
425
427
  formatter = new AsYouType('RU');
426
- expect(formatter.input('+')).to.equal('+');
427
- expect(formatter.input('7')).to.equal('+7');
428
- expect(formatter.input('+')).to.equal('+7');
428
+ (0, _chai.expect)(formatter.input('+')).to.equal('+');
429
+ (0, _chai.expect)(formatter.input('7')).to.equal('+7');
430
+ (0, _chai.expect)(formatter.input('+')).to.equal('+7');
429
431
 
430
432
  // Out-of-position '+' sign
431
433
 
432
434
  formatter = new AsYouType('RU');
433
- expect(formatter.input('8')).to.equal('8');
434
- expect(formatter.input('+')).to.equal('8');
435
+ (0, _chai.expect)(formatter.input('8')).to.equal('8');
436
+ (0, _chai.expect)(formatter.input('+')).to.equal('8');
435
437
 
436
438
  // No format matched
437
439
 
438
440
  formatter = new AsYouType('RU');
439
- expect(formatter.input('88005553535')).to.equal('8 (800) 555-35-35');
440
- expect(formatter.input('0')).to.equal('880055535350');
441
+ (0, _chai.expect)(formatter.input('88005553535')).to.equal('8 (800) 555-35-35');
442
+ (0, _chai.expect)(formatter.input('0')).to.equal('880055535350');
441
443
 
442
444
  // Invalid country phone code
443
445
 
444
446
  formatter = new AsYouType();
445
- expect(formatter.input('+0123')).to.equal('+0123');
447
+ (0, _chai.expect)(formatter.input('+0123')).to.equal('+0123');
446
448
 
447
449
  // No country specified and not an international number
448
450
 
449
451
  formatter = new AsYouType();
450
- expect(formatter.input('88005553535')).to.equal('88005553535');
452
+ (0, _chai.expect)(formatter.input('88005553535')).to.equal('88005553535');
451
453
 
452
454
  // Extract national prefix when no `national_prefix` is set
453
455
 
454
456
  formatter = new AsYouType('AD');
455
- expect(formatter.input('155555')).to.equal('155 555');
457
+ (0, _chai.expect)(formatter.input('155555')).to.equal('155 555');
456
458
 
457
459
  // Typing nonsense
458
460
 
459
461
  formatter = new AsYouType('RU');
460
- expect(formatter.input('+1abc2')).to.equal('+1');
462
+ (0, _chai.expect)(formatter.input('+1abc2')).to.equal('+1');
461
463
 
462
464
  // Should reset default country when explicitly
463
465
  // typing in an international phone number
464
466
 
465
467
  formatter = new AsYouType('RU');
466
468
  formatter.input('+');
467
- expect(type(formatter.getCountry())).to.equal('undefined');
468
- expect(type(formatter.getCountryCallingCode())).to.equal('undefined');
469
+ (0, _chai.expect)(type(formatter.getCountry())).to.equal('undefined');
470
+ (0, _chai.expect)(type(formatter.getCountryCallingCode())).to.equal('undefined');
469
471
 
470
472
  // Country not inferrable from the phone number,
471
473
  // while the phone number itself can already be formatted "completely".
472
474
 
473
475
  formatter = new AsYouType();
474
476
  formatter.input('+12223333333');
475
- expect(type(formatter.getCountry())).to.equal('undefined');
476
- expect(formatter.getCountryCallingCode()).to.equal('1');
477
+ (0, _chai.expect)(type(formatter.getCountry())).to.equal('undefined');
478
+ (0, _chai.expect)(formatter.getCountryCallingCode()).to.equal('1');
477
479
 
478
480
  // Reset a chosen format when it no longer applies given the new leading digits.
479
481
  // If Google changes metadata for England then this test might not cover the case.
480
482
  formatter = new AsYouType('GB');
481
- expect(formatter.input('0845')).to.equal('0845');
483
+ (0, _chai.expect)(formatter.input('0845')).to.equal('0845');
482
484
  // New leading digits don't match the format previously chosen.
483
485
  // Reset the format.
484
- expect(formatter.input('0')).to.equal('0845 0');
486
+ (0, _chai.expect)(formatter.input('0')).to.equal('0845 0');
485
487
  });
486
- it('should choose between matching formats based on the absence or presence of a national prefix', function () {
488
+ (0, _mocha.it)('should choose between matching formats based on the absence or presence of a national prefix', function () {
487
489
  // The first matching format:
488
490
  // {
489
491
  // "pattern": "(\\d{2})(\\d{5,6})",
@@ -514,7 +516,7 @@ describe('AsYouType', function () {
514
516
  var formatter = new AsYouType('CN');
515
517
  // National prefix has been input.
516
518
  // Chooses the first format.
517
- expect(formatter.input('01010000')).to.equal('010 10000');
519
+ (0, _chai.expect)(formatter.input('01010000')).to.equal('010 10000');
518
520
  formatter.reset();
519
521
  // No national prefix has been input,
520
522
  // and `national_prefix_for_parsing` not matched.
@@ -522,33 +524,33 @@ describe('AsYouType', function () {
522
524
  // `"national_prefix_is_optional_when_formatting": true`.
523
525
  // The second format will match, because it does have
524
526
  // `"national_prefix_is_optional_when_formatting": true`.
525
- expect(formatter.input('1010000')).to.equal('10 1000 0');
527
+ (0, _chai.expect)(formatter.input('1010000')).to.equal('10 1000 0');
526
528
  });
527
- it('should not accept phone number extensions', function () {
528
- expect(new AsYouType().input('+1-213-373-4253 ext. 123')).to.equal('+1 213 373 4253');
529
+ (0, _mocha.it)('should not accept phone number extensions', function () {
530
+ (0, _chai.expect)(new AsYouType().input('+1-213-373-4253 ext. 123')).to.equal('+1 213 373 4253');
529
531
  });
530
- it('should parse non-European digits', function () {
531
- expect(new AsYouType().input('+١٢١٢٢٣٢٣٢٣٢')).to.equal('+1 212 232 3232');
532
+ (0, _mocha.it)('should parse non-European digits', function () {
533
+ (0, _chai.expect)(new AsYouType().input('+١٢١٢٢٣٢٣٢٣٢')).to.equal('+1 212 232 3232');
532
534
  });
533
- it('should return a PhoneNumber instance', function () {
535
+ (0, _mocha.it)('should return a PhoneNumber instance', function () {
534
536
  var formatter = new AsYouType('BR');
535
537
 
536
538
  // No country calling code.
537
- expect(formatter.getNumber()).to.be.undefined;
539
+ (0, _chai.expect)(formatter.getNumber()).to.be.undefined;
538
540
  formatter.input('+1');
539
541
  // No national number digits.
540
- expect(formatter.getNumber()).to.be.undefined;
542
+ (0, _chai.expect)(formatter.getNumber()).to.be.undefined;
541
543
  formatter.input('213-373-4253');
542
544
  var phoneNumber = formatter.getNumber();
543
- expect(phoneNumber.country).to.equal('US');
544
- expect(phoneNumber.countryCallingCode).to.equal('1');
545
- expect(phoneNumber.number).to.equal('+12133734253');
546
- expect(phoneNumber.nationalNumber).to.equal('2133734253');
545
+ (0, _chai.expect)(phoneNumber.country).to.equal('US');
546
+ (0, _chai.expect)(phoneNumber.countryCallingCode).to.equal('1');
547
+ (0, _chai.expect)(phoneNumber.number).to.equal('+12133734253');
548
+ (0, _chai.expect)(phoneNumber.nationalNumber).to.equal('2133734253');
547
549
  formatter.reset();
548
550
  formatter.input('+1-113-373-4253');
549
551
  phoneNumber = formatter.getNumber();
550
- expect(phoneNumber.country).to.be.undefined;
551
- expect(phoneNumber.countryCallingCode).to.equal('1');
552
+ (0, _chai.expect)(phoneNumber.country).to.be.undefined;
553
+ (0, _chai.expect)(phoneNumber.countryCallingCode).to.equal('1');
552
554
 
553
555
  // An incorrect NANPA international phone number.
554
556
  // (contains national prefix in an international phone number)
@@ -570,19 +572,19 @@ describe('AsYouType', function () {
570
572
  // After leading digits < 3 matching was implemented:
571
573
  //
572
574
  phoneNumber = formatter.getNumber();
573
- expect(phoneNumber).to.be.undefined;
575
+ (0, _chai.expect)(phoneNumber).to.be.undefined;
574
576
  //
575
577
  formatter.input('1');
576
578
  phoneNumber = formatter.getNumber();
577
- expect(phoneNumber.country).to.be.undefined;
578
- expect(phoneNumber.countryCallingCode).to.equal('1');
579
- expect(phoneNumber.number).to.equal('+11');
579
+ (0, _chai.expect)(phoneNumber.country).to.be.undefined;
580
+ (0, _chai.expect)(phoneNumber.countryCallingCode).to.equal('1');
581
+ (0, _chai.expect)(phoneNumber.number).to.equal('+11');
580
582
  });
581
- it('should work with countries that add digits to national (significant) number', function () {
583
+ (0, _mocha.it)('should work with countries that add digits to national (significant) number', function () {
582
584
  // When formatting Argentinian mobile numbers in international format,
583
585
  // a `9` is prepended, when compared to national format.
584
586
  var asYouType = new AsYouType('AR');
585
- expect(asYouType.input('+5493435551212')).to.equal('+54 9 3435 55 1212');
587
+ (0, _chai.expect)(asYouType.input('+5493435551212')).to.equal('+54 9 3435 55 1212');
586
588
  asYouType.reset();
587
589
  // Digits shouldn't be changed when formatting in national format.
588
590
  // (no `9` is prepended).
@@ -590,9 +592,9 @@ describe('AsYouType', function () {
590
592
  // and stripping `15` from it.
591
593
  // Then uses `$2 15-$3-$4` format that strips the leading `9`
592
594
  // and adds `15`.
593
- expect(asYouType.input('0343515551212')).to.equal('03435 15-55-1212');
595
+ (0, _chai.expect)(asYouType.input('0343515551212')).to.equal('03435 15-55-1212');
594
596
  });
595
- it('should return non-formatted phone number when no format matches and national (significant) number has digits added', function () {
597
+ (0, _mocha.it)('should return non-formatted phone number when no format matches and national (significant) number has digits added', function () {
596
598
  // When inputting "0343515551212999" Argentinian mobile number,
597
599
  // the parsed national (significant) number is "93435551212999".
598
600
  // There, one can see how it stripped "0" national prefix and prepended a "9",
@@ -603,9 +605,9 @@ describe('AsYouType', function () {
603
605
  //
604
606
  var asYouType = new AsYouType('AR');
605
607
  // This line checks that the formatter didn't alter the output digits compared to the input digits.
606
- expect(asYouType.input('0343515551212999')).to.equal('0343515551212999');
608
+ (0, _chai.expect)(asYouType.input('0343515551212999')).to.equal('0343515551212999');
607
609
  });
608
- it('should format Argentina numbers (starting with 011) (digit by digit)', function () {
610
+ (0, _mocha.it)('should format Argentina numbers (starting with 011) (digit by digit)', function () {
609
611
  // Inputting a number digit-by-digit and as a whole a two different cases
610
612
  // in case of this library compared to Google's `libphonenumber`
611
613
  // that always inputs a number digit-by-digit.
@@ -613,42 +615,42 @@ describe('AsYouType', function () {
613
615
  // nextDigits 0111523456789
614
616
  // nationalNumber 91123456789
615
617
  var formatter = new AsYouType('AR');
616
- expect(formatter.input('0')).to.equal('0');
617
- expect(formatter.getTemplate()).to.equal('x');
618
- expect(formatter.input('1')).to.equal('01');
619
- expect(formatter.getTemplate()).to.equal('xx');
620
- expect(formatter.input('1')).to.equal('011');
621
- expect(formatter.getTemplate()).to.equal('xxx');
622
- expect(formatter.input('1')).to.equal('011 1');
623
- expect(formatter.getTemplate()).to.equal('xxx x');
624
- expect(formatter.input('5')).to.equal('011 15');
625
- expect(formatter.getTemplate()).to.equal('xxx xx');
626
- expect(formatter.input('2')).to.equal('011 152');
627
- expect(formatter.getTemplate()).to.equal('xxx xxx');
628
- expect(formatter.input('3')).to.equal('011 1523');
629
- expect(formatter.getTemplate()).to.equal('xxx xxxx');
630
- expect(formatter.input('4')).to.equal('011 1523-4');
631
- expect(formatter.getTemplate()).to.equal('xxx xxxx-x');
632
- expect(formatter.input('5')).to.equal('011 1523-45');
633
- expect(formatter.getTemplate()).to.equal('xxx xxxx-xx');
634
- expect(formatter.input('6')).to.equal('011 1523-456');
635
- expect(formatter.getTemplate()).to.equal('xxx xxxx-xxx');
636
- expect(formatter.input('7')).to.equal('011 1523-4567');
637
- expect(formatter.getTemplate()).to.equal('xxx xxxx-xxxx');
638
- expect(formatter.input('8')).to.equal('011152345678');
639
- expect(formatter.getTemplate()).to.equal('xxxxxxxxxxxx');
640
- expect(formatter.input('9')).to.equal('011 15-2345-6789');
641
- expect(formatter.getTemplate()).to.equal('xxx xx-xxxx-xxxx');
618
+ (0, _chai.expect)(formatter.input('0')).to.equal('0');
619
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('x');
620
+ (0, _chai.expect)(formatter.input('1')).to.equal('01');
621
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('xx');
622
+ (0, _chai.expect)(formatter.input('1')).to.equal('011');
623
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('xxx');
624
+ (0, _chai.expect)(formatter.input('1')).to.equal('011 1');
625
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('xxx x');
626
+ (0, _chai.expect)(formatter.input('5')).to.equal('011 15');
627
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('xxx xx');
628
+ (0, _chai.expect)(formatter.input('2')).to.equal('011 152');
629
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('xxx xxx');
630
+ (0, _chai.expect)(formatter.input('3')).to.equal('011 1523');
631
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('xxx xxxx');
632
+ (0, _chai.expect)(formatter.input('4')).to.equal('011 1523-4');
633
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('xxx xxxx-x');
634
+ (0, _chai.expect)(formatter.input('5')).to.equal('011 1523-45');
635
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('xxx xxxx-xx');
636
+ (0, _chai.expect)(formatter.input('6')).to.equal('011 1523-456');
637
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('xxx xxxx-xxx');
638
+ (0, _chai.expect)(formatter.input('7')).to.equal('011 1523-4567');
639
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('xxx xxxx-xxxx');
640
+ (0, _chai.expect)(formatter.input('8')).to.equal('011152345678');
641
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('xxxxxxxxxxxx');
642
+ (0, _chai.expect)(formatter.input('9')).to.equal('011 15-2345-6789');
643
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('xxx xx-xxxx-xxxx');
642
644
  // Private property (not public API).
643
- expect(formatter.state.nationalSignificantNumber).to.equal('91123456789');
645
+ (0, _chai.expect)(formatter.state.nationalSignificantNumber).to.equal('91123456789');
644
646
  // Private property (not public API).
645
647
  // `formatter.digits` is not always `formatter.nationalPrefix`
646
648
  // plus `formatter.nationalNumberDigits`.
647
- expect(formatter.state.nationalPrefix).to.equal('0');
648
- expect(formatter.isPossible()).to.equal(true);
649
- expect(formatter.isValid()).to.equal(true);
649
+ (0, _chai.expect)(formatter.state.nationalPrefix).to.equal('0');
650
+ (0, _chai.expect)(formatter.isPossible()).to.equal(true);
651
+ (0, _chai.expect)(formatter.isValid()).to.equal(true);
650
652
  });
651
- it('should format Argentina numbers (starting with 011)', function () {
653
+ (0, _mocha.it)('should format Argentina numbers (starting with 011)', function () {
652
654
  // Inputting a number digit-by-digit and as a whole a two different cases
653
655
  // in case of this library compared to Google's `libphonenumber`
654
656
  // that always inputs a number digit-by-digit.
@@ -656,61 +658,61 @@ describe('AsYouType', function () {
656
658
  // nextDigits 0111523456789
657
659
  // nationalNumber 91123456789
658
660
  var formatter = new AsYouType('AR');
659
- expect(formatter.input('0111523456789')).to.equal('011 15-2345-6789');
661
+ (0, _chai.expect)(formatter.input('0111523456789')).to.equal('011 15-2345-6789');
660
662
  // Private property (not public API).
661
- expect(formatter.state.nationalSignificantNumber).to.equal('91123456789');
663
+ (0, _chai.expect)(formatter.state.nationalSignificantNumber).to.equal('91123456789');
662
664
  // Private property (not public API).
663
665
  // `formatter.digits` is not always `formatter.nationalPrefix`
664
666
  // plus `formatter.nationalNumberDigits`.
665
- expect(formatter.state.nationalPrefix).to.equal('0');
667
+ (0, _chai.expect)(formatter.state.nationalPrefix).to.equal('0');
666
668
  // expect(formatter.nationalPrefix).to.be.undefined
667
- expect(formatter.isPossible()).to.equal(true);
668
- expect(formatter.isValid()).to.equal(true);
669
+ (0, _chai.expect)(formatter.isPossible()).to.equal(true);
670
+ (0, _chai.expect)(formatter.isValid()).to.equal(true);
669
671
  });
670
672
 
671
673
  // https://gitlab.com/catamphetamine/react-phone-number-input/-/issues/93
672
- it('should format Indonesian numbers', function () {
674
+ (0, _mocha.it)('should format Indonesian numbers', function () {
673
675
  var formatter = new AsYouType('ID');
674
- expect(formatter.getChars()).to.equal('');
676
+ (0, _chai.expect)(formatter.getChars()).to.equal('');
675
677
  // Before leading digits < 3 matching was implemented:
676
678
  // formatter.input('081').should.equal('(081)')
677
679
  // After leading digits < 3 matching was implemented:
678
- expect(formatter.input('081')).to.equal('081');
680
+ (0, _chai.expect)(formatter.input('081')).to.equal('081');
679
681
  });
680
- it('should prepend `prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix` (not a complete number)', function () {
682
+ (0, _mocha.it)('should prepend `prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix` (not a complete number)', function () {
681
683
  // A country having `national_prefix_for_parsing` with a "capturing group".
682
684
  // National prefix is either not used in a format or is optional.
683
685
  // Input phone number without a national prefix.
684
686
  var formatter = new AsYouType('AU');
685
- expect(formatter.input('1831130345678')).to.equal('1831 1303 456 78');
687
+ (0, _chai.expect)(formatter.input('1831130345678')).to.equal('1831 1303 456 78');
686
688
  // Private property (not public API).
687
- expect(formatter.state.nationalSignificantNumber).to.equal('130345678');
689
+ (0, _chai.expect)(formatter.state.nationalSignificantNumber).to.equal('130345678');
688
690
  // Private property (not public API).
689
691
  // `formatter.digits` is not always `formatter.nationalPrefix`
690
692
  // plus `formatter.nationalNumberDigits`.
691
- expect(formatter.state.nationalPrefix).to.be.undefined;
692
- expect(formatter.state.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix).to.equal('1831');
693
+ (0, _chai.expect)(formatter.state.nationalPrefix).to.be.undefined;
694
+ (0, _chai.expect)(formatter.state.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix).to.equal('1831');
693
695
  });
694
- it('should prepend `prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix` (complete number)', function () {
696
+ (0, _mocha.it)('should prepend `prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix` (complete number)', function () {
695
697
  // A country having `national_prefix_for_parsing` with a "capturing group".
696
698
  // National prefix is either not used in a format or is optional.
697
699
  // Input phone number without a national prefix.
698
700
  var formatter = new AsYouType('AU');
699
- expect(formatter.input('18311303456789')).to.equal('1831 1303 456 789');
701
+ (0, _chai.expect)(formatter.input('18311303456789')).to.equal('1831 1303 456 789');
700
702
  // Private property (not public API).
701
- expect(formatter.state.nationalSignificantNumber).to.equal('1303456789');
703
+ (0, _chai.expect)(formatter.state.nationalSignificantNumber).to.equal('1303456789');
702
704
  // Private property (not public API).
703
705
  // `formatter.digits` is not always `formatter.nationalPrefix`
704
706
  // plus `formatter.nationalNumberDigits`.
705
- expect(formatter.state.nationalPrefix).to.be.undefined;
706
- expect(formatter.state.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix).to.equal('1831');
707
+ (0, _chai.expect)(formatter.state.nationalPrefix).to.be.undefined;
708
+ (0, _chai.expect)(formatter.state.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix).to.equal('1831');
707
709
  });
708
- it('should work with Mexico numbers', function () {
710
+ (0, _mocha.it)('should work with Mexico numbers', function () {
709
711
  var asYouType = new AsYouType('MX');
710
712
 
711
713
  // Fixed line. International.
712
- expect(asYouType.input('+52(449)978-000')).to.equal('+52 449 978 000');
713
- expect(asYouType.input('1')).to.equal('+52 449 978 0001');
714
+ (0, _chai.expect)(asYouType.input('+52(449)978-000')).to.equal('+52 449 978 000');
715
+ (0, _chai.expect)(asYouType.input('1')).to.equal('+52 449 978 0001');
714
716
  asYouType.reset();
715
717
 
716
718
  // "Dialling tokens 01, 02, 044, 045 and 1 are removed as they are
@@ -723,15 +725,15 @@ describe('AsYouType', function () {
723
725
  // asYouType.reset()
724
726
 
725
727
  // Fixed line. National. Without national prefix.
726
- expect(asYouType.input('(449)978-000')).to.equal('449 978 000');
727
- expect(asYouType.getTemplate()).to.equal('xxx xxx xxx');
728
- expect(asYouType.input('1')).to.equal('449 978 0001');
729
- expect(asYouType.getTemplate()).to.equal('xxx xxx xxxx');
728
+ (0, _chai.expect)(asYouType.input('(449)978-000')).to.equal('449 978 000');
729
+ (0, _chai.expect)(asYouType.getTemplate()).to.equal('xxx xxx xxx');
730
+ (0, _chai.expect)(asYouType.input('1')).to.equal('449 978 0001');
731
+ (0, _chai.expect)(asYouType.getTemplate()).to.equal('xxx xxx xxxx');
730
732
  asYouType.reset();
731
733
 
732
734
  // Mobile.
733
- expect(asYouType.input('+52331234567')).to.equal('+52 33 1234 567');
734
- expect(asYouType.input('8')).to.equal('+52 33 1234 5678');
735
+ (0, _chai.expect)(asYouType.input('+52331234567')).to.equal('+52 33 1234 567');
736
+ (0, _chai.expect)(asYouType.input('8')).to.equal('+52 33 1234 5678');
735
737
  asYouType.reset();
736
738
 
737
739
  // "Dialling tokens 01, 02, 044, 045 and 1 are removed as they are
@@ -755,140 +757,140 @@ describe('AsYouType', function () {
755
757
  // asYouType.input('045331234567').should.equal('04533 1234 567')
756
758
  // asYouType.input('8').should.equal('04533 1234 5678')
757
759
  });
758
- it('should just prepend national prefix if national_prefix_formatting_rule does not produce a suitable number', function () {
760
+ (0, _mocha.it)('should just prepend national prefix if national_prefix_formatting_rule does not produce a suitable number', function () {
759
761
  // "national_prefix": "8"
760
762
  // "national_prefix_for_parsing": "0|80?"
761
763
  var formatter = new AsYouType('BY');
762
764
  // "national_prefix_formatting_rule": "8 $1"
763
765
  // That `national_prefix_formatting_rule` isn't used
764
766
  // because the user didn't input national prefix `8`.
765
- expect(formatter.input('0800123')).to.equal('0 800 123');
766
- expect(formatter.getTemplate()).to.equal('x xxx xxx');
767
+ (0, _chai.expect)(formatter.input('0800123')).to.equal('0 800 123');
768
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('x xxx xxx');
767
769
  });
768
- it('should not duplicate area code for certain countries', function () {
770
+ (0, _mocha.it)('should not duplicate area code for certain countries', function () {
769
771
  // https://github.com/catamphetamine/libphonenumber-js/issues/318
770
772
  var asYouType = new AsYouType('VI');
771
773
  // Even though `parse("3406934")` would return a
772
774
  // "(340) 340-6934" national number, still
773
775
  // "As You Type" formatter should leave it as "(340) 6934".
774
- expect(asYouType.input('340693')).to.equal('(340) 693');
775
- expect(asYouType.input('4')).to.equal('(340) 693-4');
776
- expect(asYouType.input('123')).to.equal('(340) 693-4123');
776
+ (0, _chai.expect)(asYouType.input('340693')).to.equal('(340) 693');
777
+ (0, _chai.expect)(asYouType.input('4')).to.equal('(340) 693-4');
778
+ (0, _chai.expect)(asYouType.input('123')).to.equal('(340) 693-4123');
777
779
  });
778
- it('shouldn\'t throw when passed a non-existent default country', function () {
779
- expect(new AsYouType('XX').input('+78005553535')).to.equal('+7 800 555 35 35');
780
- expect(new AsYouType('XX').input('88005553535')).to.equal('88005553535');
780
+ (0, _mocha.it)('shouldn\'t throw when passed a non-existent default country', function () {
781
+ (0, _chai.expect)(new AsYouType('XX').input('+78005553535')).to.equal('+7 800 555 35 35');
782
+ (0, _chai.expect)(new AsYouType('XX').input('88005553535')).to.equal('88005553535');
781
783
  });
782
- it('should parse carrier codes', function () {
784
+ (0, _mocha.it)('should parse carrier codes', function () {
783
785
  var formatter = new AsYouType('BR');
784
786
  formatter.input('0 15 21 5555-5555');
785
787
  var phoneNumber = formatter.getNumber();
786
- expect(phoneNumber.carrierCode).to.equal('15');
788
+ (0, _chai.expect)(phoneNumber.carrierCode).to.equal('15');
787
789
  formatter.reset();
788
790
  formatter.input('+1-213-373-4253');
789
791
  phoneNumber = formatter.getNumber();
790
- expect(phoneNumber.carrierCode).to.be.undefined;
792
+ (0, _chai.expect)(phoneNumber.carrierCode).to.be.undefined;
791
793
  });
792
- it('should format when default country calling code is configured', function () {
794
+ (0, _mocha.it)('should format when default country calling code is configured', function () {
793
795
  var formatter = new AsYouType({
794
796
  defaultCallingCode: '7'
795
797
  });
796
- expect(formatter.input('88005553535')).to.equal('8 (800) 555-35-35');
797
- expect(formatter.getNumber().countryCallingCode).to.equal('7');
798
- expect(formatter.getNumber().country).to.equal('RU');
798
+ (0, _chai.expect)(formatter.input('88005553535')).to.equal('8 (800) 555-35-35');
799
+ (0, _chai.expect)(formatter.getNumber().countryCallingCode).to.equal('7');
800
+ (0, _chai.expect)(formatter.getNumber().country).to.equal('RU');
799
801
  });
800
- it('shouldn\'t return PhoneNumber if country calling code hasn\'t been input yet', function () {
802
+ (0, _mocha.it)('shouldn\'t return PhoneNumber if country calling code hasn\'t been input yet', function () {
801
803
  var formatter = new AsYouType();
802
804
  formatter.input('+80');
803
- expect(formatter.getNumber()).to.be.undefined;
805
+ (0, _chai.expect)(formatter.getNumber()).to.be.undefined;
804
806
  });
805
- it('should format non-geographic numbering plan phone numbers', function () {
807
+ (0, _mocha.it)('should format non-geographic numbering plan phone numbers', function () {
806
808
  var formatter = new AsYouType();
807
- expect(formatter.input('+')).to.equal('+');
808
- expect(formatter.input('8')).to.equal('+8');
809
- expect(formatter.input('7')).to.equal('+87');
810
- expect(formatter.getCountry()).to.be.undefined;
811
- expect(formatter.input('0')).to.equal('+870');
809
+ (0, _chai.expect)(formatter.input('+')).to.equal('+');
810
+ (0, _chai.expect)(formatter.input('8')).to.equal('+8');
811
+ (0, _chai.expect)(formatter.input('7')).to.equal('+87');
812
+ (0, _chai.expect)(formatter.getCountry()).to.be.undefined;
813
+ (0, _chai.expect)(formatter.input('0')).to.equal('+870');
812
814
  if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {
813
- expect(formatter.getCountry()).to.equal('001');
815
+ (0, _chai.expect)(formatter.getCountry()).to.equal('001');
814
816
  } else {
815
- expect(formatter.getCountry()).to.be.undefined;
817
+ (0, _chai.expect)(formatter.getCountry()).to.be.undefined;
816
818
  }
817
- expect(formatter.input('7')).to.equal('+870 7');
818
- expect(formatter.input('7')).to.equal('+870 77');
819
- expect(formatter.input('3')).to.equal('+870 773');
820
- expect(formatter.input('1')).to.equal('+870 773 1');
821
- expect(formatter.input('1')).to.equal('+870 773 11');
822
- expect(formatter.input('1')).to.equal('+870 773 111');
823
- expect(formatter.input('6')).to.equal('+870 773 111 6');
824
- expect(formatter.input('3')).to.equal('+870 773 111 63');
825
- expect(formatter.input('2')).to.equal('+870 773 111 632');
819
+ (0, _chai.expect)(formatter.input('7')).to.equal('+870 7');
820
+ (0, _chai.expect)(formatter.input('7')).to.equal('+870 77');
821
+ (0, _chai.expect)(formatter.input('3')).to.equal('+870 773');
822
+ (0, _chai.expect)(formatter.input('1')).to.equal('+870 773 1');
823
+ (0, _chai.expect)(formatter.input('1')).to.equal('+870 773 11');
824
+ (0, _chai.expect)(formatter.input('1')).to.equal('+870 773 111');
825
+ (0, _chai.expect)(formatter.input('6')).to.equal('+870 773 111 6');
826
+ (0, _chai.expect)(formatter.input('3')).to.equal('+870 773 111 63');
827
+ (0, _chai.expect)(formatter.input('2')).to.equal('+870 773 111 632');
826
828
  if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {
827
- expect(formatter.getNumber().country).to.equal('001');
829
+ (0, _chai.expect)(formatter.getNumber().country).to.equal('001');
828
830
  } else {
829
- expect(formatter.getCountry()).to.be.undefined;
831
+ (0, _chai.expect)(formatter.getCountry()).to.be.undefined;
830
832
  }
831
- expect(formatter.getNumber().countryCallingCode).to.equal('870');
833
+ (0, _chai.expect)(formatter.getNumber().countryCallingCode).to.equal('870');
832
834
  });
833
- it('should format non-geographic numbering plan phone numbers (default country calling code)', function () {
835
+ (0, _mocha.it)('should format non-geographic numbering plan phone numbers (default country calling code)', function () {
834
836
  var formatter = new AsYouType({
835
837
  defaultCallingCode: '870'
836
838
  });
837
839
  if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {
838
- expect(formatter.getNumber().country).to.equal('001');
840
+ (0, _chai.expect)(formatter.getNumber().country).to.equal('001');
839
841
  } else {
840
- expect(formatter.getCountry()).to.be.undefined;
842
+ (0, _chai.expect)(formatter.getCountry()).to.be.undefined;
841
843
  }
842
- expect(formatter.input('7')).to.equal('7');
843
- expect(formatter.input('7')).to.equal('77');
844
- expect(formatter.input('3')).to.equal('773');
845
- expect(formatter.input('1')).to.equal('773 1');
846
- expect(formatter.input('1')).to.equal('773 11');
847
- expect(formatter.input('1')).to.equal('773 111');
848
- expect(formatter.input('6')).to.equal('773 111 6');
849
- expect(formatter.input('3')).to.equal('773 111 63');
850
- expect(formatter.input('2')).to.equal('773 111 632');
844
+ (0, _chai.expect)(formatter.input('7')).to.equal('7');
845
+ (0, _chai.expect)(formatter.input('7')).to.equal('77');
846
+ (0, _chai.expect)(formatter.input('3')).to.equal('773');
847
+ (0, _chai.expect)(formatter.input('1')).to.equal('773 1');
848
+ (0, _chai.expect)(formatter.input('1')).to.equal('773 11');
849
+ (0, _chai.expect)(formatter.input('1')).to.equal('773 111');
850
+ (0, _chai.expect)(formatter.input('6')).to.equal('773 111 6');
851
+ (0, _chai.expect)(formatter.input('3')).to.equal('773 111 63');
852
+ (0, _chai.expect)(formatter.input('2')).to.equal('773 111 632');
851
853
  if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {
852
- expect(formatter.getNumber().country).to.equal('001');
854
+ (0, _chai.expect)(formatter.getNumber().country).to.equal('001');
853
855
  } else {
854
- expect(formatter.getCountry()).to.be.undefined;
856
+ (0, _chai.expect)(formatter.getCountry()).to.be.undefined;
855
857
  }
856
- expect(formatter.getNumber().countryCallingCode).to.equal('870');
858
+ (0, _chai.expect)(formatter.getNumber().countryCallingCode).to.equal('870');
857
859
  });
858
- it('should not format non-geographic numbering plan phone numbers (default country 001)', function () {
860
+ (0, _mocha.it)('should not format non-geographic numbering plan phone numbers (default country 001)', function () {
859
861
  var formatter = new AsYouType('001');
860
- expect(formatter.defaultCountry).to.be.undefined;
861
- expect(formatter.defaultCallingCode).to.be.undefined;
862
- expect(formatter.input('7')).to.equal('7');
863
- expect(formatter.input('7')).to.equal('77');
864
- expect(formatter.input('3')).to.equal('773');
865
- expect(formatter.input('1')).to.equal('7731');
866
- expect(formatter.input('1')).to.equal('77311');
867
- expect(formatter.input('1')).to.equal('773111');
868
- expect(formatter.input('6')).to.equal('7731116');
869
- expect(formatter.input('3')).to.equal('77311163');
870
- expect(formatter.input('2')).to.equal('773111632');
871
- expect(formatter.getCountry()).to.be.undefined;
872
- expect(formatter.getNumber()).to.be.undefined;
873
- });
874
- it('should return PhoneNumber (should strip national prefix `1` in E.164 value)', function () {
862
+ (0, _chai.expect)(formatter.defaultCountry).to.be.undefined;
863
+ (0, _chai.expect)(formatter.defaultCallingCode).to.be.undefined;
864
+ (0, _chai.expect)(formatter.input('7')).to.equal('7');
865
+ (0, _chai.expect)(formatter.input('7')).to.equal('77');
866
+ (0, _chai.expect)(formatter.input('3')).to.equal('773');
867
+ (0, _chai.expect)(formatter.input('1')).to.equal('7731');
868
+ (0, _chai.expect)(formatter.input('1')).to.equal('77311');
869
+ (0, _chai.expect)(formatter.input('1')).to.equal('773111');
870
+ (0, _chai.expect)(formatter.input('6')).to.equal('7731116');
871
+ (0, _chai.expect)(formatter.input('3')).to.equal('77311163');
872
+ (0, _chai.expect)(formatter.input('2')).to.equal('773111632');
873
+ (0, _chai.expect)(formatter.getCountry()).to.be.undefined;
874
+ (0, _chai.expect)(formatter.getNumber()).to.be.undefined;
875
+ });
876
+ (0, _mocha.it)('should return PhoneNumber (should strip national prefix `1` in E.164 value)', function () {
875
877
  var formatter = new AsYouType('RU');
876
878
  formatter.input('+1111');
877
- expect(formatter.getNumber().number).to.equal('+111');
879
+ (0, _chai.expect)(formatter.getNumber().number).to.equal('+111');
878
880
  });
879
- it('should return PhoneNumber with autocorrected international numbers without leading +', function () {
881
+ (0, _mocha.it)('should return PhoneNumber with autocorrected international numbers without leading +', function () {
880
882
  // https://github.com/catamphetamine/libphonenumber-js/issues/316
881
883
  var formatter = new AsYouType('FR');
882
- expect(formatter.input('33612902554')).to.equal('33 6 12 90 25 54');
883
- expect(formatter.getNumber().country).to.equal('FR');
884
- expect(formatter.getNumber().nationalNumber).to.equal('612902554');
885
- expect(formatter.getNumber().number).to.equal('+33612902554');
884
+ (0, _chai.expect)(formatter.input('33612902554')).to.equal('33 6 12 90 25 54');
885
+ (0, _chai.expect)(formatter.getNumber().country).to.equal('FR');
886
+ (0, _chai.expect)(formatter.getNumber().nationalNumber).to.equal('612902554');
887
+ (0, _chai.expect)(formatter.getNumber().number).to.equal('+33612902554');
886
888
  // Should also strip national prefix.
887
889
  formatter.reset();
888
- expect(formatter.input('330612902554')).to.equal('33 06 12 90 25 54');
889
- expect(formatter.getNumber().country).to.equal('FR');
890
- expect(formatter.getNumber().nationalNumber).to.equal('612902554');
891
- expect(formatter.getNumber().number).to.equal('+33612902554');
890
+ (0, _chai.expect)(formatter.input('330612902554')).to.equal('33 06 12 90 25 54');
891
+ (0, _chai.expect)(formatter.getNumber().country).to.equal('FR');
892
+ (0, _chai.expect)(formatter.getNumber().nationalNumber).to.equal('612902554');
893
+ (0, _chai.expect)(formatter.getNumber().number).to.equal('+33612902554');
892
894
  // On second thought, this "prepend default area code" feature won't be added,
893
895
  // because when a user selects "British Virgin Islands" and inputs
894
896
  // "2291234", then they see "(229) 123-4" which clearly indicates that
@@ -903,148 +905,148 @@ describe('AsYouType', function () {
903
905
  // formatter2.getNumber().nationalNumber.should.equal('2842291234')
904
906
  // formatter2.getNumber().number.should.equal('+12842291234')
905
907
  });
906
- it('should work with out-of-country dialing prefix (like 00)', function () {
908
+ (0, _mocha.it)('should work with out-of-country dialing prefix (like 00)', function () {
907
909
  var formatter = new AsYouType('DE');
908
- expect(formatter.input('00498911196611')).to.equal('00 49 89 11196611');
909
- expect(formatter.getCountry()).to.equal('DE');
910
- expect(formatter.formatter.template).to.equal('xx xx xx xxxxxxxx');
911
- expect(formatter.formatter.populatedNationalNumberTemplate).to.equal('89 11196611');
912
- expect(formatter.getTemplate()).to.equal('xx xx xx xxxxxxxx');
913
- expect(formatter.getNumber().country).to.equal('DE');
914
- expect(formatter.getNumber().nationalNumber).to.equal('8911196611');
915
- expect(formatter.getNumber().number).to.equal('+498911196611');
916
- });
917
- it('shouldn\'t choose a format when there\'re too many digits for any of them', function () {
910
+ (0, _chai.expect)(formatter.input('00498911196611')).to.equal('00 49 89 11196611');
911
+ (0, _chai.expect)(formatter.getCountry()).to.equal('DE');
912
+ (0, _chai.expect)(formatter.formatter.template).to.equal('xx xx xx xxxxxxxx');
913
+ (0, _chai.expect)(formatter.formatter.populatedNationalNumberTemplate).to.equal('89 11196611');
914
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('xx xx xx xxxxxxxx');
915
+ (0, _chai.expect)(formatter.getNumber().country).to.equal('DE');
916
+ (0, _chai.expect)(formatter.getNumber().nationalNumber).to.equal('8911196611');
917
+ (0, _chai.expect)(formatter.getNumber().number).to.equal('+498911196611');
918
+ });
919
+ (0, _mocha.it)('shouldn\'t choose a format when there\'re too many digits for any of them', function () {
918
920
  var formatter = new AsYouType('RU');
919
921
  formatter.input('89991112233');
920
- expect(formatter.formatter.chosenFormat.format()).to.equal('$1 $2-$3-$4');
922
+ (0, _chai.expect)(formatter.formatter.chosenFormat.format()).to.equal('$1 $2-$3-$4');
921
923
  formatter.reset();
922
924
  formatter.input('899911122334');
923
- expect(formatter.formatter.chosenFormat).to.be.undefined;
925
+ (0, _chai.expect)(formatter.formatter.chosenFormat).to.be.undefined;
924
926
  });
925
- it('should get separator after national prefix', function () {
927
+ (0, _mocha.it)('should get separator after national prefix', function () {
926
928
  // Russia.
927
929
  // Has separator after national prefix.
928
930
  var formatter = new AsYouType('RU');
929
931
  var format = formatter.metadata.formats()[0];
930
- expect(format.nationalPrefixFormattingRule()).to.equal('8 ($1)');
931
- expect(formatter.formatter.getSeparatorAfterNationalPrefix(format)).to.equal(' ');
932
+ (0, _chai.expect)(format.nationalPrefixFormattingRule()).to.equal('8 ($1)');
933
+ (0, _chai.expect)(formatter.formatter.getSeparatorAfterNationalPrefix(format)).to.equal(' ');
932
934
  // Britain.
933
935
  // Has no separator after national prefix.
934
936
  var formatter2 = new AsYouType('GB');
935
937
  var format2 = formatter2.metadata.formats()[0];
936
- expect(format2.nationalPrefixFormattingRule()).to.equal('0$1');
937
- expect(formatter2.formatter.getSeparatorAfterNationalPrefix(format2)).to.equal('');
938
+ (0, _chai.expect)(format2.nationalPrefixFormattingRule()).to.equal('0$1');
939
+ (0, _chai.expect)(formatter2.formatter.getSeparatorAfterNationalPrefix(format2)).to.equal('');
938
940
  });
939
- it('should return if the number is possible', function () {
941
+ (0, _mocha.it)('should return if the number is possible', function () {
940
942
  // National. Russia.
941
943
  var formatter = new AsYouType('RU');
942
- expect(formatter.isPossible()).to.equal(false);
944
+ (0, _chai.expect)(formatter.isPossible()).to.equal(false);
943
945
  formatter.input('8');
944
- expect(formatter.isPossible()).to.equal(false);
946
+ (0, _chai.expect)(formatter.isPossible()).to.equal(false);
945
947
  formatter.input('8005553535');
946
- expect(formatter.isPossible()).to.equal(true);
948
+ (0, _chai.expect)(formatter.isPossible()).to.equal(true);
947
949
  formatter.input('5');
948
- expect(formatter.isPossible()).to.equal(false);
950
+ (0, _chai.expect)(formatter.isPossible()).to.equal(false);
949
951
  });
950
- it('should return if the number is valid', function () {
952
+ (0, _mocha.it)('should return if the number is valid', function () {
951
953
  // National. Russia.
952
954
  var formatter = new AsYouType('RU');
953
- expect(formatter.isValid()).to.equal(false);
955
+ (0, _chai.expect)(formatter.isValid()).to.equal(false);
954
956
  formatter.input('88005553535');
955
- expect(formatter.isValid()).to.equal(true);
957
+ (0, _chai.expect)(formatter.isValid()).to.equal(true);
956
958
  formatter.input('5');
957
- expect(formatter.isValid()).to.equal(false);
959
+ (0, _chai.expect)(formatter.isValid()).to.equal(false);
958
960
  });
959
- it('should return if the number is international', function () {
961
+ (0, _mocha.it)('should return if the number is international', function () {
960
962
  // National. Russia.
961
963
  var formatter = new AsYouType('RU');
962
- expect(formatter.isInternational()).to.equal(false);
964
+ (0, _chai.expect)(formatter.isInternational()).to.equal(false);
963
965
  formatter.input('88005553535');
964
- expect(formatter.isInternational()).to.equal(false);
966
+ (0, _chai.expect)(formatter.isInternational()).to.equal(false);
965
967
  // International. Russia.
966
968
  var formatterInt = new AsYouType();
967
- expect(formatterInt.isInternational()).to.equal(false);
969
+ (0, _chai.expect)(formatterInt.isInternational()).to.equal(false);
968
970
  formatterInt.input('+');
969
- expect(formatterInt.isInternational()).to.equal(true);
971
+ (0, _chai.expect)(formatterInt.isInternational()).to.equal(true);
970
972
  formatterInt.input('78005553535');
971
- expect(formatterInt.isInternational()).to.equal(true);
973
+ (0, _chai.expect)(formatterInt.isInternational()).to.equal(true);
972
974
  });
973
- it('should return country calling code part of the number', function () {
975
+ (0, _mocha.it)('should return country calling code part of the number', function () {
974
976
  // National. Russia.
975
977
  var formatter = new AsYouType('RU');
976
- expect(formatter.getCountryCallingCode()).to.be.undefined;
978
+ (0, _chai.expect)(formatter.getCountryCallingCode()).to.be.undefined;
977
979
  formatter.input('88005553535');
978
- expect(formatter.getCountryCallingCode()).to.be.undefined;
980
+ (0, _chai.expect)(formatter.getCountryCallingCode()).to.be.undefined;
979
981
  // International. Russia.
980
982
  var formatterInt = new AsYouType();
981
- expect(formatterInt.getCountryCallingCode()).to.be.undefined;
983
+ (0, _chai.expect)(formatterInt.getCountryCallingCode()).to.be.undefined;
982
984
  formatterInt.input('+');
983
- expect(formatterInt.getCountryCallingCode()).to.be.undefined;
985
+ (0, _chai.expect)(formatterInt.getCountryCallingCode()).to.be.undefined;
984
986
  formatterInt.input('7');
985
- expect(formatterInt.getCountryCallingCode()).to.equal('7');
987
+ (0, _chai.expect)(formatterInt.getCountryCallingCode()).to.equal('7');
986
988
  formatterInt.input('8005553535');
987
- expect(formatterInt.getCountryCallingCode()).to.equal('7');
989
+ (0, _chai.expect)(formatterInt.getCountryCallingCode()).to.equal('7');
988
990
  });
989
- it('should return the country of the number', function () {
991
+ (0, _mocha.it)('should return the country of the number', function () {
990
992
  // National. Russia.
991
993
  var formatter = new AsYouType('RU');
992
- expect(formatter.getCountry()).to.be.undefined;
994
+ (0, _chai.expect)(formatter.getCountry()).to.be.undefined;
993
995
  formatter.input('8');
994
- expect(formatter.getCountry()).to.equal('RU');
996
+ (0, _chai.expect)(formatter.getCountry()).to.equal('RU');
995
997
  formatter.input('8005553535');
996
- expect(formatter.getCountry()).to.equal('RU');
998
+ (0, _chai.expect)(formatter.getCountry()).to.equal('RU');
997
999
  // International. Austria.
998
1000
  var formatterInt = new AsYouType();
999
- expect(formatterInt.getCountry()).to.be.undefined;
1001
+ (0, _chai.expect)(formatterInt.getCountry()).to.be.undefined;
1000
1002
  formatterInt.input('+');
1001
- expect(formatterInt.getCountry()).to.be.undefined;
1003
+ (0, _chai.expect)(formatterInt.getCountry()).to.be.undefined;
1002
1004
  formatterInt.input('43');
1003
- expect(formatterInt.getCountry()).to.equal('AT');
1005
+ (0, _chai.expect)(formatterInt.getCountry()).to.equal('AT');
1004
1006
  // International. USA.
1005
1007
  var formatterIntRu = new AsYouType();
1006
- expect(formatterIntRu.getCountry()).to.be.undefined;
1008
+ (0, _chai.expect)(formatterIntRu.getCountry()).to.be.undefined;
1007
1009
  formatterIntRu.input('+');
1008
- expect(formatterIntRu.getCountry()).to.be.undefined;
1010
+ (0, _chai.expect)(formatterIntRu.getCountry()).to.be.undefined;
1009
1011
  formatterIntRu.input('1');
1010
- expect(formatterIntRu.getCountry()).to.be.undefined;
1012
+ (0, _chai.expect)(formatterIntRu.getCountry()).to.be.undefined;
1011
1013
  formatterIntRu.input('2133734253');
1012
- expect(formatterIntRu.getCountry()).to.equal('US');
1014
+ (0, _chai.expect)(formatterIntRu.getCountry()).to.equal('US');
1013
1015
  formatterIntRu.input('1');
1014
- expect(formatterIntRu.getCountry()).to.be.undefined;
1016
+ (0, _chai.expect)(formatterIntRu.getCountry()).to.be.undefined;
1015
1017
  });
1016
- it('should parse a long IDD prefix', function () {
1018
+ (0, _mocha.it)('should parse a long IDD prefix', function () {
1017
1019
  var formatter = new AsYouType('AU');
1018
1020
  // `14880011` is a long IDD prefix in Australia.
1019
- expect(formatter.input('1')).to.equal('1');
1020
- expect(formatter.input('4')).to.equal('14');
1021
- expect(formatter.input('8')).to.equal('148');
1022
- expect(formatter.input('8')).to.equal('1488');
1023
- expect(formatter.input('0')).to.equal('14880');
1024
- expect(formatter.input('0')).to.equal('148800');
1025
- expect(formatter.input('1')).to.equal('1488001');
1026
- expect(formatter.input('1')).to.equal('14880011');
1021
+ (0, _chai.expect)(formatter.input('1')).to.equal('1');
1022
+ (0, _chai.expect)(formatter.input('4')).to.equal('14');
1023
+ (0, _chai.expect)(formatter.input('8')).to.equal('148');
1024
+ (0, _chai.expect)(formatter.input('8')).to.equal('1488');
1025
+ (0, _chai.expect)(formatter.input('0')).to.equal('14880');
1026
+ (0, _chai.expect)(formatter.input('0')).to.equal('148800');
1027
+ (0, _chai.expect)(formatter.input('1')).to.equal('1488001');
1028
+ (0, _chai.expect)(formatter.input('1')).to.equal('14880011');
1027
1029
  // As if were calling US using `14880011` IDD prefix,
1028
1030
  // though that prefix could mean something else.
1029
- expect(formatter.input('1')).to.equal('14880011 1');
1030
- expect(formatter.input('2')).to.equal('14880011 1 2');
1031
- expect(formatter.input('1')).to.equal('14880011 1 21');
1032
- expect(formatter.input('3')).to.equal('14880011 1 213');
1031
+ (0, _chai.expect)(formatter.input('1')).to.equal('14880011 1');
1032
+ (0, _chai.expect)(formatter.input('2')).to.equal('14880011 1 2');
1033
+ (0, _chai.expect)(formatter.input('1')).to.equal('14880011 1 21');
1034
+ (0, _chai.expect)(formatter.input('3')).to.equal('14880011 1 213');
1033
1035
  });
1034
- it('should return the phone number characters entered by the user', function () {
1036
+ (0, _mocha.it)('should return the phone number characters entered by the user', function () {
1035
1037
  var formatter = new AsYouType('RU');
1036
- expect(formatter.getChars()).to.equal('');
1038
+ (0, _chai.expect)(formatter.getChars()).to.equal('');
1037
1039
  formatter.input('+123');
1038
- expect(formatter.getChars()).to.equal('+123');
1040
+ (0, _chai.expect)(formatter.getChars()).to.equal('+123');
1039
1041
  formatter.reset();
1040
1042
  formatter.input('123');
1041
- expect(formatter.getChars()).to.equal('123');
1043
+ (0, _chai.expect)(formatter.getChars()).to.equal('123');
1042
1044
  });
1043
1045
 
1044
1046
  // A test confirming the case when input `"11"` for country `"US"`
1045
1047
  // produces `value` `"+11"`.
1046
1048
  // https://gitlab.com/catamphetamine/react-phone-number-input/-/issues/113
1047
- it('should determine the national (significant) part correctly when input with national prefix in US', function () {
1049
+ (0, _mocha.it)('should determine the national (significant) part correctly when input with national prefix in US', function () {
1048
1050
  var formatter = new AsYouType('US');
1049
1051
  // As soon as the user has input `"11"`, no `format` matches
1050
1052
  // those "national number" digits in the `"US"` country metadata.
@@ -1054,281 +1056,281 @@ describe('AsYouType', function () {
1054
1056
  // So it acts as if the leading `"+"` is there,
1055
1057
  // as if the user's input is `"+11"`.
1056
1058
  // See `AsYouType.fixMissingPlus()` function.
1057
- expect(formatter.input('1 122 222 2222 3')).to.equal('1 1 222 222 2223');
1058
- expect(formatter.getNumber().nationalNumber).to.equal('2222222223');
1059
+ (0, _chai.expect)(formatter.input('1 122 222 2222 3')).to.equal('1 1 222 222 2223');
1060
+ (0, _chai.expect)(formatter.getNumber().nationalNumber).to.equal('2222222223');
1059
1061
  });
1060
1062
  });
1061
- describe('AsYouType.getNumberValue()', function () {
1062
- it('should return E.164 number value (national number, with national prefix, default country: US)', function () {
1063
+ (0, _mocha.describe)('AsYouType.getNumberValue()', function () {
1064
+ (0, _mocha.it)('should return E.164 number value (national number, with national prefix, default country: US)', function () {
1063
1065
  var formatter = new AsYouType('US');
1064
- expect(formatter.getNumberValue()).to.be.undefined;
1066
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1065
1067
  formatter.input('');
1066
- expect(formatter.getNumberValue()).to.be.undefined;
1068
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1067
1069
  formatter.input('1');
1068
- expect(formatter.getNumberValue()).to.equal('+1');
1070
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+1');
1069
1071
  formatter.input('2');
1070
- expect(formatter.getNumberValue()).to.equal('+12');
1072
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+12');
1071
1073
  formatter.input('1');
1072
- expect(formatter.getNumberValue()).to.equal('+121');
1074
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+121');
1073
1075
  formatter.input('3');
1074
- expect(formatter.getNumberValue()).to.equal('+1213');
1076
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+1213');
1075
1077
  formatter.input('373-4253');
1076
- expect(formatter.getNumberValue()).to.equal('+12133734253');
1078
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+12133734253');
1077
1079
  formatter.input('4');
1078
- expect(formatter.getNumberValue()).to.equal('+121337342534');
1080
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+121337342534');
1079
1081
  });
1080
- it('should return E.164 number value (national number, with national prefix, default calling code: 1)', function () {
1082
+ (0, _mocha.it)('should return E.164 number value (national number, with national prefix, default calling code: 1)', function () {
1081
1083
  var formatter = new AsYouType({
1082
1084
  defaultCallingCode: '1'
1083
1085
  });
1084
- expect(formatter.getNumberValue()).to.be.undefined;
1086
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1085
1087
  formatter.input('');
1086
- expect(formatter.getNumberValue()).to.be.undefined;
1088
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1087
1089
  formatter.input('1');
1088
- expect(formatter.getNumberValue()).to.equal('+1');
1090
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+1');
1089
1091
  formatter.input('2');
1090
- expect(formatter.getNumberValue()).to.equal('+12');
1092
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+12');
1091
1093
  formatter.input('1');
1092
- expect(formatter.getNumberValue()).to.equal('+121');
1094
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+121');
1093
1095
  formatter.input('3');
1094
- expect(formatter.getNumberValue()).to.equal('+1213');
1096
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+1213');
1095
1097
  formatter.input('373-4253');
1096
- expect(formatter.getNumberValue()).to.equal('+12133734253');
1098
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+12133734253');
1097
1099
  formatter.input('4');
1098
- expect(formatter.getNumberValue()).to.equal('+121337342534');
1100
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+121337342534');
1099
1101
  });
1100
- it('should return E.164 number value (national number, default country: US)', function () {
1102
+ (0, _mocha.it)('should return E.164 number value (national number, default country: US)', function () {
1101
1103
  var formatter = new AsYouType('US');
1102
- expect(formatter.getNumberValue()).to.be.undefined;
1104
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1103
1105
  formatter.input('');
1104
- expect(formatter.getNumberValue()).to.be.undefined;
1106
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1105
1107
  formatter.input('2');
1106
- expect(formatter.getNumberValue()).to.equal('+12');
1108
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+12');
1107
1109
  formatter.input('1');
1108
- expect(formatter.getNumberValue()).to.equal('+121');
1110
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+121');
1109
1111
  formatter.input('3');
1110
- expect(formatter.getNumberValue()).to.equal('+1213');
1112
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+1213');
1111
1113
  formatter.input('373-4253');
1112
- expect(formatter.getNumberValue()).to.equal('+12133734253');
1114
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+12133734253');
1113
1115
  formatter.input('4');
1114
- expect(formatter.getNumberValue()).to.equal('+121337342534');
1116
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+121337342534');
1115
1117
  });
1116
- it('should return E.164 number value (national number, default calling code: 1)', function () {
1118
+ (0, _mocha.it)('should return E.164 number value (national number, default calling code: 1)', function () {
1117
1119
  var formatter = new AsYouType({
1118
1120
  defaultCallingCode: '1'
1119
1121
  });
1120
- expect(formatter.getNumberValue()).to.be.undefined;
1122
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1121
1123
  formatter.input('');
1122
- expect(formatter.getNumberValue()).to.be.undefined;
1124
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1123
1125
  formatter.input('2');
1124
- expect(formatter.getNumberValue()).to.equal('+12');
1126
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+12');
1125
1127
  formatter.input('1');
1126
- expect(formatter.getNumberValue()).to.equal('+121');
1128
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+121');
1127
1129
  formatter.input('3');
1128
- expect(formatter.getNumberValue()).to.equal('+1213');
1130
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+1213');
1129
1131
  formatter.input('373-4253');
1130
- expect(formatter.getNumberValue()).to.equal('+12133734253');
1132
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+12133734253');
1131
1133
  formatter.input('4');
1132
- expect(formatter.getNumberValue()).to.equal('+121337342534');
1134
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+121337342534');
1133
1135
  });
1134
- it('should return E.164 number value (international number, not a valid calling code)', function () {
1136
+ (0, _mocha.it)('should return E.164 number value (international number, not a valid calling code)', function () {
1135
1137
  var formatter = new AsYouType();
1136
- expect(formatter.getNumberValue()).to.be.undefined;
1138
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1137
1139
  formatter.input('');
1138
- expect(formatter.getNumberValue()).to.be.undefined;
1140
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1139
1141
  formatter.input('+');
1140
- expect(formatter.getNumberValue()).to.be.undefined;
1142
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1141
1143
  formatter.input('2150');
1142
- expect(formatter.getNumberValue()).to.equal('+2150');
1144
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+2150');
1143
1145
  });
1144
- it('should return E.164 number value (international number, default country: US)', function () {
1146
+ (0, _mocha.it)('should return E.164 number value (international number, default country: US)', function () {
1145
1147
  var formatter = new AsYouType('US');
1146
- expect(formatter.getNumberValue()).to.be.undefined;
1148
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1147
1149
  formatter.input('');
1148
- expect(formatter.getNumberValue()).to.be.undefined;
1150
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1149
1151
  formatter.input('+');
1150
- expect(formatter.getNumberValue()).to.be.undefined;
1152
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1151
1153
  formatter.input('1');
1152
- expect(formatter.getNumberValue()).to.equal('+1');
1154
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+1');
1153
1155
  formatter.input('1');
1154
- expect(formatter.getNumberValue()).to.equal('+1');
1156
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+1');
1155
1157
  formatter.input('2');
1156
- expect(formatter.getNumberValue()).to.equal('+12');
1158
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+12');
1157
1159
  formatter.input('1');
1158
- expect(formatter.getNumberValue()).to.equal('+121');
1160
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+121');
1159
1161
  formatter.input('3');
1160
- expect(formatter.getNumberValue()).to.equal('+1213');
1162
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+1213');
1161
1163
  formatter.input('373-4253');
1162
- expect(formatter.getNumberValue()).to.equal('+12133734253');
1164
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+12133734253');
1163
1165
  formatter.input('4');
1164
- expect(formatter.getNumberValue()).to.equal('+121337342534');
1166
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+121337342534');
1165
1167
  });
1166
- it('should return E.164 number value (international number, other default country: RU)', function () {
1168
+ (0, _mocha.it)('should return E.164 number value (international number, other default country: RU)', function () {
1167
1169
  var formatter = new AsYouType('RU');
1168
- expect(formatter.getNumberValue()).to.be.undefined;
1170
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1169
1171
  formatter.input('');
1170
- expect(formatter.getNumberValue()).to.be.undefined;
1172
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1171
1173
  formatter.input('+');
1172
- expect(formatter.getNumberValue()).to.be.undefined;
1174
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1173
1175
  formatter.input('1');
1174
- expect(formatter.getNumberValue()).to.equal('+1');
1176
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+1');
1175
1177
  formatter.input('1');
1176
- expect(formatter.getNumberValue()).to.equal('+1');
1178
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+1');
1177
1179
  formatter.input('2');
1178
- expect(formatter.getNumberValue()).to.equal('+12');
1180
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+12');
1179
1181
  formatter.input('1');
1180
- expect(formatter.getNumberValue()).to.equal('+121');
1182
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+121');
1181
1183
  formatter.input('3');
1182
- expect(formatter.getNumberValue()).to.equal('+1213');
1184
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+1213');
1183
1185
  formatter.input('373-4253');
1184
- expect(formatter.getNumberValue()).to.equal('+12133734253');
1186
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+12133734253');
1185
1187
  formatter.input('4');
1186
- expect(formatter.getNumberValue()).to.equal('+121337342534');
1188
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+121337342534');
1187
1189
  });
1188
- it('should return E.164 number value (international number, default calling code: 1)', function () {
1190
+ (0, _mocha.it)('should return E.164 number value (international number, default calling code: 1)', function () {
1189
1191
  var formatter = new AsYouType('US', {
1190
1192
  defaultCallingCode: '1'
1191
1193
  });
1192
- expect(formatter.getNumberValue()).to.be.undefined;
1194
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1193
1195
  formatter.input('');
1194
- expect(formatter.getNumberValue()).to.be.undefined;
1196
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1195
1197
  formatter.input('+');
1196
- expect(formatter.getNumberValue()).to.be.undefined;
1198
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1197
1199
  formatter.input('1');
1198
- expect(formatter.getNumberValue()).to.equal('+1');
1200
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+1');
1199
1201
  formatter.input('1');
1200
- expect(formatter.getNumberValue()).to.equal('+1');
1202
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+1');
1201
1203
  formatter.input('2');
1202
- expect(formatter.getNumberValue()).to.equal('+12');
1204
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+12');
1203
1205
  formatter.input('1');
1204
- expect(formatter.getNumberValue()).to.equal('+121');
1206
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+121');
1205
1207
  formatter.input('3');
1206
- expect(formatter.getNumberValue()).to.equal('+1213');
1208
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+1213');
1207
1209
  formatter.input('373-4253');
1208
- expect(formatter.getNumberValue()).to.equal('+12133734253');
1210
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+12133734253');
1209
1211
  formatter.input('4');
1210
- expect(formatter.getNumberValue()).to.equal('+121337342534');
1212
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+121337342534');
1211
1213
  });
1212
- it('should return E.164 number value (international number, other default calling code: 7)', function () {
1214
+ (0, _mocha.it)('should return E.164 number value (international number, other default calling code: 7)', function () {
1213
1215
  var formatter = new AsYouType('US', {
1214
1216
  defaultCallingCode: '7'
1215
1217
  });
1216
- expect(formatter.getNumberValue()).to.be.undefined;
1218
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1217
1219
  formatter.input('');
1218
- expect(formatter.getNumberValue()).to.be.undefined;
1220
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1219
1221
  formatter.input('+');
1220
- expect(formatter.getNumberValue()).to.be.undefined;
1222
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1221
1223
  formatter.input('1');
1222
- expect(formatter.getNumberValue()).to.equal('+1');
1224
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+1');
1223
1225
  formatter.input('1');
1224
- expect(formatter.getNumberValue()).to.equal('+1');
1226
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+1');
1225
1227
  formatter.input('2');
1226
- expect(formatter.getNumberValue()).to.equal('+12');
1228
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+12');
1227
1229
  formatter.input('1');
1228
- expect(formatter.getNumberValue()).to.equal('+121');
1230
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+121');
1229
1231
  formatter.input('3');
1230
- expect(formatter.getNumberValue()).to.equal('+1213');
1232
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+1213');
1231
1233
  formatter.input('373-4253');
1232
- expect(formatter.getNumberValue()).to.equal('+12133734253');
1234
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+12133734253');
1233
1235
  formatter.input('4');
1234
- expect(formatter.getNumberValue()).to.equal('+121337342534');
1236
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+121337342534');
1235
1237
  });
1236
- it('should return E.164 number value (international number)', function () {
1238
+ (0, _mocha.it)('should return E.164 number value (international number)', function () {
1237
1239
  var formatter = new AsYouType();
1238
- expect(formatter.getNumberValue()).to.be.undefined;
1240
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1239
1241
  formatter.input('');
1240
- expect(formatter.getNumberValue()).to.be.undefined;
1242
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1241
1243
  formatter.input('+');
1242
- expect(formatter.getNumberValue()).to.be.undefined;
1244
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1243
1245
  formatter.input('1');
1244
- expect(formatter.getNumberValue()).to.equal('+1');
1246
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+1');
1245
1247
  formatter.input('1');
1246
- expect(formatter.getNumberValue()).to.equal('+1');
1248
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+1');
1247
1249
  formatter.input('2');
1248
- expect(formatter.getNumberValue()).to.equal('+12');
1250
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+12');
1249
1251
  formatter.input('1');
1250
- expect(formatter.getNumberValue()).to.equal('+121');
1252
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+121');
1251
1253
  formatter.input('3');
1252
- expect(formatter.getNumberValue()).to.equal('+1213');
1254
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+1213');
1253
1255
  formatter.input('373-4253');
1254
- expect(formatter.getNumberValue()).to.equal('+12133734253');
1256
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+12133734253');
1255
1257
  formatter.input('4');
1256
- expect(formatter.getNumberValue()).to.equal('+121337342534');
1258
+ (0, _chai.expect)(formatter.getNumberValue()).to.equal('+121337342534');
1257
1259
  });
1258
- it('should return E.164 number value (national number) (no default country or calling code)', function () {
1260
+ (0, _mocha.it)('should return E.164 number value (national number) (no default country or calling code)', function () {
1259
1261
  var formatter = new AsYouType();
1260
- expect(formatter.getNumberValue()).to.be.undefined;
1262
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1261
1263
  formatter.input('');
1262
- expect(formatter.getNumberValue()).to.be.undefined;
1264
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1263
1265
  formatter.input('1');
1264
- expect(formatter.getNumberValue()).to.be.undefined;
1266
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1265
1267
  formatter.input('12');
1266
- expect(formatter.getNumberValue()).to.be.undefined;
1268
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1267
1269
  formatter.input('3');
1268
- expect(formatter.getNumberValue()).to.be.undefined;
1270
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1269
1271
  formatter.input('373-4253');
1270
- expect(formatter.getNumberValue()).to.be.undefined;
1272
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1271
1273
  formatter.input('4');
1272
- expect(formatter.getNumberValue()).to.be.undefined;
1274
+ (0, _chai.expect)(formatter.getNumberValue()).to.be.undefined;
1273
1275
  });
1274
- it('should not drop any input digits', function () {
1276
+ (0, _mocha.it)('should not drop any input digits', function () {
1275
1277
  // Test "+529011234567" number, proactively ensuring that no formatting is applied,
1276
1278
  // where a format is chosen that would otherwise have led to some digits being dropped.
1277
1279
  var formatter = new AsYouType('MX');
1278
- expect(formatter.input('9')).to.equal('9');
1279
- expect(formatter.input('0')).to.equal('90');
1280
- expect(formatter.input('1')).to.equal('901');
1281
- expect(formatter.input('1')).to.equal('901 1');
1282
- expect(formatter.input('2')).to.equal('901 12');
1283
- expect(formatter.input('3')).to.equal('901 123');
1284
- expect(formatter.input('4')).to.equal('901 123 4');
1285
- expect(formatter.input('5')).to.equal('901 123 45');
1286
- expect(formatter.input('6')).to.equal('901 123 456');
1287
- expect(formatter.input('7')).to.equal('901 123 4567');
1288
- });
1289
- it('should work for formats with no leading digits (`leadingDigitsPatternsCount === 0`)', function () {
1280
+ (0, _chai.expect)(formatter.input('9')).to.equal('9');
1281
+ (0, _chai.expect)(formatter.input('0')).to.equal('90');
1282
+ (0, _chai.expect)(formatter.input('1')).to.equal('901');
1283
+ (0, _chai.expect)(formatter.input('1')).to.equal('901 1');
1284
+ (0, _chai.expect)(formatter.input('2')).to.equal('901 12');
1285
+ (0, _chai.expect)(formatter.input('3')).to.equal('901 123');
1286
+ (0, _chai.expect)(formatter.input('4')).to.equal('901 123 4');
1287
+ (0, _chai.expect)(formatter.input('5')).to.equal('901 123 45');
1288
+ (0, _chai.expect)(formatter.input('6')).to.equal('901 123 456');
1289
+ (0, _chai.expect)(formatter.input('7')).to.equal('901 123 4567');
1290
+ });
1291
+ (0, _mocha.it)('should work for formats with no leading digits (`leadingDigitsPatternsCount === 0`)', function () {
1290
1292
  var formatter = new AsYouType({
1291
1293
  defaultCallingCode: 888
1292
1294
  });
1293
- expect(formatter.input('1')).to.equal('1');
1295
+ (0, _chai.expect)(formatter.input('1')).to.equal('1');
1294
1296
  });
1295
- it('should work for SK phone numbers', function () {
1297
+ (0, _mocha.it)('should work for SK phone numbers', function () {
1296
1298
  // There was a bug: "leading digits" `"2"` matched "leading digits pattern" `"90"`.
1297
1299
  // The incorrect `.match()` function result was `{ oveflow: true }`
1298
1300
  // while it should've been `undefined`.
1299
1301
  // https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/66
1300
1302
  var formatter = new AsYouType('SK');
1301
- expect(formatter.input('090')).to.equal('090');
1303
+ (0, _chai.expect)(formatter.input('090')).to.equal('090');
1302
1304
  formatter.reset();
1303
- expect(formatter.input('080')).to.equal('080');
1305
+ (0, _chai.expect)(formatter.input('080')).to.equal('080');
1304
1306
  formatter.reset();
1305
- expect(formatter.input('059')).to.equal('059');
1307
+ (0, _chai.expect)(formatter.input('059')).to.equal('059');
1306
1308
  });
1307
- it('should work for SK phone numbers (2)', function () {
1309
+ (0, _mocha.it)('should work for SK phone numbers (2)', function () {
1308
1310
  // https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/69
1309
1311
  var formatter = new AsYouType('SK');
1310
- expect(formatter.input('421901222333')).to.equal('421 901 222 333');
1311
- expect(formatter.getTemplate()).to.equal('xxx xxx xxx xxx');
1312
+ (0, _chai.expect)(formatter.input('421901222333')).to.equal('421 901 222 333');
1313
+ (0, _chai.expect)(formatter.getTemplate()).to.equal('xxx xxx xxx xxx');
1312
1314
  });
1313
- it('should not choose `defaultCountry` over the "main" one when both the `defaultCountry` and the "main" one match the phone number', function () {
1315
+ (0, _mocha.it)('should not choose `defaultCountry` over the "main" one when both the `defaultCountry` and the "main" one match the phone number', function () {
1314
1316
  // This phone number matches both US and CA because they have the same
1315
1317
  // regular expression for some weird reason.
1316
1318
  // https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/103
1317
1319
  var formatter = new AsYouType('CA');
1318
1320
  formatter.input('8004001000');
1319
- expect(formatter.getNumber().country).not.to.equal('CA');
1320
- expect(formatter.getNumber().country).to.equal('US');
1321
+ (0, _chai.expect)(formatter.getNumber().country).not.to.equal('CA');
1322
+ (0, _chai.expect)(formatter.getNumber().country).to.equal('US');
1321
1323
 
1322
1324
  // This phone number is specific to CA.
1323
1325
  var formatter2 = new AsYouType('US');
1324
1326
  formatter2.input('4389999999');
1325
- expect(formatter2.getNumber().country).to.equal('CA');
1327
+ (0, _chai.expect)(formatter2.getNumber().country).to.equal('CA');
1326
1328
 
1327
1329
  // This phone number doesn't belong neither to CA nor to US.
1328
1330
  // In fact, it doesn't belong to any country from the "NANPA" zone.
1329
1331
  var formatter3 = new AsYouType('US');
1330
1332
  formatter3.input('1111111111');
1331
- expect(formatter3.getNumber().country).to.equal('US');
1333
+ (0, _chai.expect)(formatter3.getNumber().country).to.equal('US');
1332
1334
  });
1333
1335
  });
1334
1336
  function type(something) {