libphonenumber-js 1.9.36 → 1.9.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.
- package/CHANGELOG.md +5 -0
- package/build/AsYouType.test.js +25 -3
- package/build/AsYouType.test.js.map +1 -1
- package/build/AsYouTypeFormatter.PatternMatcher.js +435 -0
- package/build/AsYouTypeFormatter.PatternMatcher.js.map +1 -0
- package/build/AsYouTypeFormatter.PatternMatcher.test.js +447 -0
- package/build/AsYouTypeFormatter.PatternMatcher.test.js.map +1 -0
- package/build/AsYouTypeFormatter.js +45 -10
- package/build/AsYouTypeFormatter.js.map +1 -1
- package/build/PhoneNumber.test.js +6 -0
- package/build/PhoneNumber.test.js.map +1 -1
- package/bundle/libphonenumber-js.min.js +1 -1
- package/bundle/libphonenumber-js.min.js.map +1 -1
- package/bundle/libphonenumber-max.js +1 -1
- package/bundle/libphonenumber-max.js.map +1 -1
- package/bundle/libphonenumber-min.js +1 -1
- package/bundle/libphonenumber-min.js.map +1 -1
- package/bundle/libphonenumber-mobile.js +1 -1
- package/bundle/libphonenumber-mobile.js.map +1 -1
- package/es6/AsYouType.test.js +25 -3
- package/es6/AsYouType.test.js.map +1 -1
- package/es6/AsYouTypeFormatter.PatternMatcher.js +428 -0
- package/es6/AsYouTypeFormatter.PatternMatcher.js.map +1 -0
- package/es6/AsYouTypeFormatter.PatternMatcher.test.js +442 -0
- package/es6/AsYouTypeFormatter.PatternMatcher.test.js.map +1 -0
- package/es6/AsYouTypeFormatter.js +44 -10
- package/es6/AsYouTypeFormatter.js.map +1 -1
- package/es6/PhoneNumber.test.js +6 -0
- package/es6/PhoneNumber.test.js.map +1 -1
- package/metadata.full.json +1 -1
- package/metadata.full.json.js +1 -1
- package/metadata.min.json +1 -1
- package/metadata.min.json.js +1 -1
- package/metadata.mobile.json +1 -1
- package/metadata.mobile.json.js +1 -1
- package/package.json +1 -1
- package/source/AsYouType.test.js +26 -3
- package/source/AsYouTypeFormatter.PatternMatcher.js +343 -0
- package/source/AsYouTypeFormatter.PatternMatcher.test.js +596 -0
- package/source/AsYouTypeFormatter.js +47 -9
- package/source/PhoneNumber.test.js +7 -0
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
import PatternMatcher from './AsYouTypeFormatter.PatternMatcher';
|
|
2
|
+
describe('AsYouTypeFormatter.PatternMatcher', function () {
|
|
3
|
+
it('should match a one-digit pattern', function () {
|
|
4
|
+
var matcher = new PatternMatcher('4');
|
|
5
|
+
expect(matcher.match('1')).to.be.undefined;
|
|
6
|
+
matcher.match('4').should.deep.equal({
|
|
7
|
+
match: true
|
|
8
|
+
});
|
|
9
|
+
expect(matcher.match('44')).to.be.undefined;
|
|
10
|
+
matcher.match('44', {
|
|
11
|
+
allowOverflow: true
|
|
12
|
+
}).should.deep.equal({
|
|
13
|
+
overflow: true
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
it('should match a two-digit pattern', function () {
|
|
17
|
+
var matcher = new PatternMatcher('44');
|
|
18
|
+
expect(matcher.match('1')).to.be.undefined;
|
|
19
|
+
matcher.match('4').should.deep.equal({
|
|
20
|
+
partialMatch: true
|
|
21
|
+
});
|
|
22
|
+
matcher.match('44').should.deep.equal({
|
|
23
|
+
match: true
|
|
24
|
+
});
|
|
25
|
+
expect(matcher.match('444')).to.be.undefined;
|
|
26
|
+
matcher.match('444', {
|
|
27
|
+
allowOverflow: true
|
|
28
|
+
}).should.deep.equal({
|
|
29
|
+
overflow: true
|
|
30
|
+
});
|
|
31
|
+
expect(matcher.match('55')).to.be.undefined;
|
|
32
|
+
});
|
|
33
|
+
it('should match a one-digit one-of set (single digit)', function () {
|
|
34
|
+
var matcher = new PatternMatcher('[4]');
|
|
35
|
+
expect(matcher.match('1')).to.be.undefined;
|
|
36
|
+
matcher.match('4').should.deep.equal({
|
|
37
|
+
match: true
|
|
38
|
+
});
|
|
39
|
+
expect(matcher.match('44')).to.be.undefined;
|
|
40
|
+
matcher.match('44', {
|
|
41
|
+
allowOverflow: true
|
|
42
|
+
}).should.deep.equal({
|
|
43
|
+
overflow: true
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
it('should match a one-digit one-of set (multiple digits)', function () {
|
|
47
|
+
var matcher = new PatternMatcher('[479]');
|
|
48
|
+
expect(matcher.match('1')).to.be.undefined;
|
|
49
|
+
matcher.match('4').should.deep.equal({
|
|
50
|
+
match: true
|
|
51
|
+
});
|
|
52
|
+
expect(matcher.match('44')).to.be.undefined;
|
|
53
|
+
matcher.match('44', {
|
|
54
|
+
allowOverflow: true
|
|
55
|
+
}).should.deep.equal({
|
|
56
|
+
overflow: true
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
it('should match a one-digit one-of set using a dash notation (not inclusive)', function () {
|
|
60
|
+
var matcher = new PatternMatcher('[2-5]');
|
|
61
|
+
expect(matcher.match('1')).to.be.undefined;
|
|
62
|
+
matcher.match('4').should.deep.equal({
|
|
63
|
+
match: true
|
|
64
|
+
});
|
|
65
|
+
expect(matcher.match('44')).to.be.undefined;
|
|
66
|
+
matcher.match('44', {
|
|
67
|
+
allowOverflow: true
|
|
68
|
+
}).should.deep.equal({
|
|
69
|
+
overflow: true
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
it('should match a one-digit one-of set using a dash notation (inclusive)', function () {
|
|
73
|
+
var matcher = new PatternMatcher('[3-4]');
|
|
74
|
+
expect(matcher.match('1')).to.be.undefined;
|
|
75
|
+
matcher.match('4').should.deep.equal({
|
|
76
|
+
match: true
|
|
77
|
+
});
|
|
78
|
+
expect(matcher.match('44')).to.be.undefined;
|
|
79
|
+
matcher.match('44', {
|
|
80
|
+
allowOverflow: true
|
|
81
|
+
}).should.deep.equal({
|
|
82
|
+
overflow: true
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
it('should match a one-digit one-of set including a dash notation', function () {
|
|
86
|
+
var matcher = new PatternMatcher('[124-68]');
|
|
87
|
+
expect(matcher.match('0')).to.be.undefined;
|
|
88
|
+
matcher.match('1').should.deep.equal({
|
|
89
|
+
match: true
|
|
90
|
+
});
|
|
91
|
+
matcher.match('2').should.deep.equal({
|
|
92
|
+
match: true
|
|
93
|
+
});
|
|
94
|
+
expect(matcher.match('3')).to.be.undefined;
|
|
95
|
+
matcher.match('4').should.deep.equal({
|
|
96
|
+
match: true
|
|
97
|
+
});
|
|
98
|
+
matcher.match('5').should.deep.equal({
|
|
99
|
+
match: true
|
|
100
|
+
});
|
|
101
|
+
matcher.match('6').should.deep.equal({
|
|
102
|
+
match: true
|
|
103
|
+
});
|
|
104
|
+
expect(matcher.match('7')).to.be.undefined;
|
|
105
|
+
matcher.match('8').should.deep.equal({
|
|
106
|
+
match: true
|
|
107
|
+
});
|
|
108
|
+
expect(matcher.match('9')).to.be.undefined;
|
|
109
|
+
expect(matcher.match('88')).to.be.undefined;
|
|
110
|
+
matcher.match('88', {
|
|
111
|
+
allowOverflow: true
|
|
112
|
+
}).should.deep.equal({
|
|
113
|
+
overflow: true
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
it('should match a two-digit one-of set', function () {
|
|
117
|
+
var matcher = new PatternMatcher('[479][45]');
|
|
118
|
+
expect(matcher.match('1')).to.be.undefined;
|
|
119
|
+
matcher.match('4').should.deep.equal({
|
|
120
|
+
partialMatch: true
|
|
121
|
+
});
|
|
122
|
+
expect(matcher.match('5')).to.be.undefined;
|
|
123
|
+
expect(matcher.match('55')).to.be.undefined;
|
|
124
|
+
matcher.match('44').should.deep.equal({
|
|
125
|
+
match: true
|
|
126
|
+
});
|
|
127
|
+
expect(matcher.match('444')).to.be.undefined;
|
|
128
|
+
matcher.match('444', {
|
|
129
|
+
allowOverflow: true
|
|
130
|
+
}).should.deep.equal({
|
|
131
|
+
overflow: true
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
it('should match a two-digit one-of set (regular digit and a one-of set)', function () {
|
|
135
|
+
var matcher = new PatternMatcher('1[45]');
|
|
136
|
+
expect(matcher.match('0')).to.be.undefined;
|
|
137
|
+
matcher.match('1').should.deep.equal({
|
|
138
|
+
partialMatch: true
|
|
139
|
+
});
|
|
140
|
+
matcher.match('15').should.deep.equal({
|
|
141
|
+
match: true
|
|
142
|
+
});
|
|
143
|
+
expect(matcher.match('16')).to.be.undefined;
|
|
144
|
+
});
|
|
145
|
+
it('should match a pattern with an or group', function () {
|
|
146
|
+
var matcher = new PatternMatcher('7(?:1[0-68]|2[1-9])');
|
|
147
|
+
expect(matcher.match('1')).to.be.undefined;
|
|
148
|
+
matcher.match('7').should.deep.equal({
|
|
149
|
+
partialMatch: true
|
|
150
|
+
});
|
|
151
|
+
matcher.match('71').should.deep.equal({
|
|
152
|
+
partialMatch: true
|
|
153
|
+
});
|
|
154
|
+
expect(matcher.match('73')).to.be.undefined;
|
|
155
|
+
matcher.match('711').should.deep.equal({
|
|
156
|
+
match: true
|
|
157
|
+
});
|
|
158
|
+
expect(matcher.match('717')).to.be.undefined;
|
|
159
|
+
expect(matcher.match('720')).to.be.undefined;
|
|
160
|
+
matcher.match('722').should.deep.equal({
|
|
161
|
+
match: true
|
|
162
|
+
});
|
|
163
|
+
expect(matcher.match('7222')).to.be.undefined;
|
|
164
|
+
matcher.match('7222', {
|
|
165
|
+
allowOverflow: true
|
|
166
|
+
}).should.deep.equal({
|
|
167
|
+
overflow: true
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
it('should match an or pattern containing or groups', function () {
|
|
171
|
+
var matcher = new PatternMatcher('2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])');
|
|
172
|
+
expect(matcher.match('1')).to.be.undefined;
|
|
173
|
+
matcher.match('2').should.deep.equal({
|
|
174
|
+
partialMatch: true
|
|
175
|
+
});
|
|
176
|
+
matcher.match('3').should.deep.equal({
|
|
177
|
+
partialMatch: true
|
|
178
|
+
});
|
|
179
|
+
expect(matcher.match('4')).to.be.undefined;
|
|
180
|
+
expect(matcher.match('21')).to.be.undefined;
|
|
181
|
+
matcher.match('22').should.deep.equal({
|
|
182
|
+
partialMatch: true
|
|
183
|
+
});
|
|
184
|
+
expect(matcher.match('221')).to.be.undefined;
|
|
185
|
+
matcher.match('222').should.deep.equal({
|
|
186
|
+
match: true
|
|
187
|
+
});
|
|
188
|
+
expect(matcher.match('2222')).to.be.undefined;
|
|
189
|
+
matcher.match('2222', {
|
|
190
|
+
allowOverflow: true
|
|
191
|
+
}).should.deep.equal({
|
|
192
|
+
overflow: true
|
|
193
|
+
});
|
|
194
|
+
matcher.match('3').should.deep.equal({
|
|
195
|
+
partialMatch: true
|
|
196
|
+
});
|
|
197
|
+
matcher.match('33').should.deep.equal({
|
|
198
|
+
partialMatch: true
|
|
199
|
+
});
|
|
200
|
+
matcher.match('332').should.deep.equal({
|
|
201
|
+
match: true
|
|
202
|
+
});
|
|
203
|
+
expect(matcher.match('333')).to.be.undefined;
|
|
204
|
+
});
|
|
205
|
+
it('should match an or pattern', function () {
|
|
206
|
+
var matcher = new PatternMatcher('6|8');
|
|
207
|
+
expect(matcher.match('5')).to.be.undefined;
|
|
208
|
+
matcher.match('6').should.deep.equal({
|
|
209
|
+
match: true
|
|
210
|
+
});
|
|
211
|
+
expect(matcher.match('7')).to.be.undefined;
|
|
212
|
+
matcher.match('8').should.deep.equal({
|
|
213
|
+
match: true
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
it('should match an or pattern (one-of sets)', function () {
|
|
217
|
+
var matcher = new PatternMatcher('[123]|[5-8]');
|
|
218
|
+
expect(matcher.match('0')).to.be.undefined;
|
|
219
|
+
matcher.match('1').should.deep.equal({
|
|
220
|
+
match: true
|
|
221
|
+
});
|
|
222
|
+
matcher.match('2').should.deep.equal({
|
|
223
|
+
match: true
|
|
224
|
+
});
|
|
225
|
+
matcher.match('3').should.deep.equal({
|
|
226
|
+
match: true
|
|
227
|
+
});
|
|
228
|
+
expect(matcher.match('4')).to.be.undefined;
|
|
229
|
+
matcher.match('5').should.deep.equal({
|
|
230
|
+
match: true
|
|
231
|
+
});
|
|
232
|
+
matcher.match('6').should.deep.equal({
|
|
233
|
+
match: true
|
|
234
|
+
});
|
|
235
|
+
matcher.match('7').should.deep.equal({
|
|
236
|
+
match: true
|
|
237
|
+
});
|
|
238
|
+
matcher.match('8').should.deep.equal({
|
|
239
|
+
match: true
|
|
240
|
+
});
|
|
241
|
+
expect(matcher.match('9')).to.be.undefined;
|
|
242
|
+
expect(matcher.match('18')).to.be.undefined;
|
|
243
|
+
matcher.match('18', {
|
|
244
|
+
allowOverflow: true
|
|
245
|
+
}).should.deep.equal({
|
|
246
|
+
overflow: true
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
it('should match an or pattern (different lengths)', function () {
|
|
250
|
+
var matcher = new PatternMatcher('60|8');
|
|
251
|
+
expect(matcher.match('5')).to.be.undefined;
|
|
252
|
+
matcher.match('6').should.deep.equal({
|
|
253
|
+
partialMatch: true
|
|
254
|
+
});
|
|
255
|
+
matcher.match('60').should.deep.equal({
|
|
256
|
+
match: true
|
|
257
|
+
});
|
|
258
|
+
expect(matcher.match('61')).to.be.undefined;
|
|
259
|
+
expect(matcher.match('7')).to.be.undefined;
|
|
260
|
+
matcher.match('8').should.deep.equal({
|
|
261
|
+
match: true
|
|
262
|
+
});
|
|
263
|
+
expect(matcher.match('68')).to.be.undefined;
|
|
264
|
+
});
|
|
265
|
+
it('should match an or pattern (one-of sets) (different lengths)', function () {
|
|
266
|
+
var matcher = new PatternMatcher('[123]|[5-8][2-8]');
|
|
267
|
+
expect(matcher.match('0')).to.be.undefined;
|
|
268
|
+
});
|
|
269
|
+
it('should match an or pattern (one-of sets and regular digits) (different lengths)', function () {
|
|
270
|
+
var matcher = new PatternMatcher('[2358][2-5]|4');
|
|
271
|
+
expect(matcher.match('0')).to.be.undefined;
|
|
272
|
+
matcher.match('2').should.deep.equal({
|
|
273
|
+
partialMatch: true
|
|
274
|
+
});
|
|
275
|
+
expect(matcher.match('21')).to.be.undefined;
|
|
276
|
+
matcher.match('22').should.deep.equal({
|
|
277
|
+
match: true
|
|
278
|
+
});
|
|
279
|
+
matcher.match('25').should.deep.equal({
|
|
280
|
+
match: true
|
|
281
|
+
});
|
|
282
|
+
expect(matcher.match('26')).to.be.undefined;
|
|
283
|
+
expect(matcher.match('222')).to.be.undefined;
|
|
284
|
+
matcher.match('222', {
|
|
285
|
+
allowOverflow: true
|
|
286
|
+
}).should.deep.equal({
|
|
287
|
+
overflow: true
|
|
288
|
+
});
|
|
289
|
+
matcher.match('3').should.deep.equal({
|
|
290
|
+
partialMatch: true
|
|
291
|
+
});
|
|
292
|
+
matcher.match('4').should.deep.equal({
|
|
293
|
+
match: true
|
|
294
|
+
});
|
|
295
|
+
expect(matcher.match('6')).to.be.undefined;
|
|
296
|
+
});
|
|
297
|
+
it('should match an or pattern (one-of sets and regular digits mixed) (different lengths)', function () {
|
|
298
|
+
var matcher = new PatternMatcher('[2358]2|4');
|
|
299
|
+
expect(matcher.match('0')).to.be.undefined;
|
|
300
|
+
matcher.match('2').should.deep.equal({
|
|
301
|
+
partialMatch: true
|
|
302
|
+
});
|
|
303
|
+
expect(matcher.match('21')).to.be.undefined;
|
|
304
|
+
matcher.match('22').should.deep.equal({
|
|
305
|
+
match: true
|
|
306
|
+
});
|
|
307
|
+
expect(matcher.match('222')).to.be.undefined;
|
|
308
|
+
matcher.match('222', {
|
|
309
|
+
allowOverflow: true
|
|
310
|
+
}).should.deep.equal({
|
|
311
|
+
overflow: true
|
|
312
|
+
});
|
|
313
|
+
matcher.match('3').should.deep.equal({
|
|
314
|
+
partialMatch: true
|
|
315
|
+
});
|
|
316
|
+
matcher.match('4').should.deep.equal({
|
|
317
|
+
match: true
|
|
318
|
+
});
|
|
319
|
+
expect(matcher.match('6')).to.be.undefined;
|
|
320
|
+
});
|
|
321
|
+
it('should match an or pattern (one-of sets groups and regular digits mixed) (different lengths)', function () {
|
|
322
|
+
var matcher = new PatternMatcher('1(?:11|[2-9])');
|
|
323
|
+
matcher.match('1').should.deep.equal({
|
|
324
|
+
partialMatch: true
|
|
325
|
+
});
|
|
326
|
+
expect(matcher.match('10')).to.be.undefined;
|
|
327
|
+
matcher.match('11').should.deep.equal({
|
|
328
|
+
partialMatch: true
|
|
329
|
+
});
|
|
330
|
+
matcher.match('111').should.deep.equal({
|
|
331
|
+
match: true
|
|
332
|
+
});
|
|
333
|
+
expect(matcher.match('1111')).to.be.undefined;
|
|
334
|
+
matcher.match('1111', {
|
|
335
|
+
allowOverflow: true
|
|
336
|
+
}).should.deep.equal({
|
|
337
|
+
overflow: true
|
|
338
|
+
});
|
|
339
|
+
matcher.match('12').should.deep.equal({
|
|
340
|
+
match: true
|
|
341
|
+
});
|
|
342
|
+
expect(matcher.match('122')).to.be.undefined;
|
|
343
|
+
matcher.match('19').should.deep.equal({
|
|
344
|
+
match: true
|
|
345
|
+
});
|
|
346
|
+
expect(matcher.match('5')).to.be.undefined;
|
|
347
|
+
});
|
|
348
|
+
it('should match nested or groups', function () {
|
|
349
|
+
var matcher = new PatternMatcher('1(?:2(?:3(?:4|5)|6)|7(?:8|9))0');
|
|
350
|
+
matcher.match('1').should.deep.equal({
|
|
351
|
+
partialMatch: true
|
|
352
|
+
});
|
|
353
|
+
expect(matcher.match('2')).to.be.undefined;
|
|
354
|
+
expect(matcher.match('11')).to.be.undefined;
|
|
355
|
+
matcher.match('12').should.deep.equal({
|
|
356
|
+
partialMatch: true
|
|
357
|
+
});
|
|
358
|
+
expect(matcher.match('121')).to.be.undefined;
|
|
359
|
+
matcher.match('123').should.deep.equal({
|
|
360
|
+
partialMatch: true
|
|
361
|
+
});
|
|
362
|
+
expect(matcher.match('1231')).to.be.undefined;
|
|
363
|
+
matcher.match('1234').should.deep.equal({
|
|
364
|
+
partialMatch: true
|
|
365
|
+
});
|
|
366
|
+
matcher.match('12340').should.deep.equal({
|
|
367
|
+
match: true
|
|
368
|
+
});
|
|
369
|
+
expect(matcher.match('123401')).to.be.undefined;
|
|
370
|
+
matcher.match('123401', {
|
|
371
|
+
allowOverflow: true
|
|
372
|
+
}).should.deep.equal({
|
|
373
|
+
overflow: true
|
|
374
|
+
});
|
|
375
|
+
matcher.match('12350').should.deep.equal({
|
|
376
|
+
match: true
|
|
377
|
+
});
|
|
378
|
+
expect(matcher.match('12360')).to.be.undefined;
|
|
379
|
+
matcher.match('1260').should.deep.equal({
|
|
380
|
+
match: true
|
|
381
|
+
});
|
|
382
|
+
expect(matcher.match('1270')).to.be.undefined;
|
|
383
|
+
expect(matcher.match('1770')).to.be.undefined;
|
|
384
|
+
matcher.match('1780').should.deep.equal({
|
|
385
|
+
match: true
|
|
386
|
+
});
|
|
387
|
+
matcher.match('1790').should.deep.equal({
|
|
388
|
+
match: true
|
|
389
|
+
});
|
|
390
|
+
expect(matcher.match('18')).to.be.undefined;
|
|
391
|
+
});
|
|
392
|
+
it('should match complex patterns', function () {
|
|
393
|
+
var matcher = new PatternMatcher('(?:31|4)6|51|6(?:5[0-3579]|[6-9])|7(?:20|32|8)|[89]');
|
|
394
|
+
expect(matcher.match('0')).to.be.undefined;
|
|
395
|
+
matcher.match('3').should.deep.equal({
|
|
396
|
+
partialMatch: true
|
|
397
|
+
});
|
|
398
|
+
matcher.match('31').should.deep.equal({
|
|
399
|
+
partialMatch: true
|
|
400
|
+
});
|
|
401
|
+
expect(matcher.match('32')).to.be.undefined;
|
|
402
|
+
matcher.match('316').should.deep.equal({
|
|
403
|
+
match: true
|
|
404
|
+
});
|
|
405
|
+
expect(matcher.match('315')).to.be.undefined;
|
|
406
|
+
matcher.match('4').should.deep.equal({
|
|
407
|
+
partialMatch: true
|
|
408
|
+
});
|
|
409
|
+
matcher.match('46').should.deep.equal({
|
|
410
|
+
match: true
|
|
411
|
+
});
|
|
412
|
+
expect(matcher.match('47')).to.be.undefined;
|
|
413
|
+
matcher.match('5').should.deep.equal({
|
|
414
|
+
partialMatch: true
|
|
415
|
+
});
|
|
416
|
+
expect(matcher.match('50')).to.be.undefined;
|
|
417
|
+
matcher.match('51').should.deep.equal({
|
|
418
|
+
match: true
|
|
419
|
+
});
|
|
420
|
+
matcher.match('6').should.deep.equal({
|
|
421
|
+
partialMatch: true
|
|
422
|
+
});
|
|
423
|
+
expect(matcher.match('64')).to.be.undefined;
|
|
424
|
+
matcher.match('65').should.deep.equal({
|
|
425
|
+
partialMatch: true
|
|
426
|
+
});
|
|
427
|
+
matcher.match('650').should.deep.equal({
|
|
428
|
+
match: true
|
|
429
|
+
});
|
|
430
|
+
expect(matcher.match('654')).to.be.undefined;
|
|
431
|
+
matcher.match('69').should.deep.equal({
|
|
432
|
+
match: true
|
|
433
|
+
});
|
|
434
|
+
matcher.match('8').should.deep.equal({
|
|
435
|
+
match: true
|
|
436
|
+
});
|
|
437
|
+
matcher.match('9').should.deep.equal({
|
|
438
|
+
match: true
|
|
439
|
+
});
|
|
440
|
+
});
|
|
441
|
+
});
|
|
442
|
+
//# sourceMappingURL=AsYouTypeFormatter.PatternMatcher.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../source/AsYouTypeFormatter.PatternMatcher.test.js"],"names":["PatternMatcher","describe","it","matcher","expect","match","to","be","undefined","should","deep","equal","allowOverflow","overflow","partialMatch"],"mappings":"AAAA,OAAOA,cAAP,MAA2B,qCAA3B;AAEAC,QAAQ,CAAC,mCAAD,EAAsC,YAAW;AACxDC,EAAAA,EAAE,CAAC,kCAAD,EAAqC,YAAW;AACjD,QAAMC,OAAO,GAAG,IAAIH,cAAJ,CAAmB,GAAnB,CAAhB;AAEAI,IAAAA,MAAM,CAACD,OAAO,CAACE,KAAR,CAAc,GAAd,CAAD,CAAN,CAA2BC,EAA3B,CAA8BC,EAA9B,CAAiCC,SAAjC;AAEAL,IAAAA,OAAO,CAACE,KAAR,CAAc,GAAd,EAAmBI,MAAnB,CAA0BC,IAA1B,CAA+BC,KAA/B,CAAqC;AACpCN,MAAAA,KAAK,EAAE;AAD6B,KAArC;AAIAD,IAAAA,MAAM,CA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MAAAA,YAAY,EAAE;AADuB,KAAtC;AAIAX,IAAAA,OAAO,CAACE,KAAR,CAAc,KAAd,EAAqBI,MAArB,CAA4BC,IAA5B,CAAiCC,KAAjC,CAAuC;AACtCN,MAAAA,KAAK,EAAE;AAD+B,KAAvC;AAIAD,IAAAA,MAAM,CAACD,OAAO,CAACE,KAAR,CAAc,KAAd,CAAD,CAAN,CAA6BC,EAA7B,CAAgCC,EAAhC,CAAmCC,SAAnC;AAEAL,IAAAA,OAAO,CAACE,KAAR,CAAc,IAAd,EAAoBI,MAApB,CAA2BC,IAA3B,CAAgCC,KAAhC,CAAsC;AACrCN,MAAAA,KAAK,EAAE;AAD8B,KAAtC;AAIAF,IAAAA,OAAO,CAACE,KAAR,CAAc,GAAd,EAAmBI,MAAnB,CAA0BC,IAA1B,CAA+BC,KAA/B,CAAqC;AACpCN,MAAAA,KAAK,EAAE;AAD6B,KAArC;AAIAF,IAAAA,OAAO,CAACE,KAAR,CAAc,GAAd,EAAmBI,MAAnB,CAA0BC,IAA1B,CAA+BC,KAA/B,CAAqC;AACpCN,MAAAA,KAAK,EAAE;AAD6B,KAArC;AAGA,GApEC,CAAF;AAqEA,CAjlBO,CAAR","sourcesContent":["import PatternMatcher from './AsYouTypeFormatter.PatternMatcher'\r\n\r\ndescribe('AsYouTypeFormatter.PatternMatcher', function() {\r\n\tit('should match a one-digit pattern', function() {\r\n\t\tconst matcher = new PatternMatcher('4')\r\n\r\n\t\texpect(matcher.match('1')).to.be.undefined\r\n\r\n\t\tmatcher.match('4').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('44')).to.be.undefined\r\n\r\n\t\tmatcher.match('44', { allowOverflow: true }).should.deep.equal({\r\n\t\t\toverflow: true\r\n\t\t})\r\n\t})\r\n\r\n\tit('should match a two-digit pattern', function() {\r\n\t\tconst matcher = new PatternMatcher('44')\r\n\r\n\t\texpect(matcher.match('1')).to.be.undefined\r\n\r\n\t\tmatcher.match('4').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('44').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('444')).to.be.undefined\r\n\r\n\t\tmatcher.match('444', { allowOverflow: true }).should.deep.equal({\r\n\t\t\toverflow: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('55')).to.be.undefined\r\n\t})\r\n\r\n\tit('should match a one-digit one-of set (single digit)', function() {\r\n\t\tconst matcher = new PatternMatcher('[4]')\r\n\r\n\t\texpect(matcher.match('1')).to.be.undefined\r\n\r\n\t\tmatcher.match('4').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('44')).to.be.undefined\r\n\r\n\t\tmatcher.match('44', { allowOverflow: true }).should.deep.equal({\r\n\t\t\toverflow: true\r\n\t\t})\r\n\t})\r\n\r\n\tit('should match a one-digit one-of set (multiple digits)', function() {\r\n\t\tconst matcher = new PatternMatcher('[479]')\r\n\r\n\t\texpect(matcher.match('1')).to.be.undefined\r\n\r\n\t\tmatcher.match('4').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('44')).to.be.undefined\r\n\r\n\t\tmatcher.match('44', { allowOverflow: true }).should.deep.equal({\r\n\t\t\toverflow: true\r\n\t\t})\r\n\t})\r\n\r\n\tit('should match a one-digit one-of set using a dash notation (not inclusive)', function() {\r\n\t\tconst matcher = new PatternMatcher('[2-5]')\r\n\r\n\t\texpect(matcher.match('1')).to.be.undefined\r\n\r\n\t\tmatcher.match('4').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('44')).to.be.undefined\r\n\r\n\t\tmatcher.match('44', { allowOverflow: true }).should.deep.equal({\r\n\t\t\toverflow: true\r\n\t\t})\r\n\t})\r\n\r\n\tit('should match a one-digit one-of set using a dash notation (inclusive)', function() {\r\n\t\tconst matcher = new PatternMatcher('[3-4]')\r\n\r\n\t\texpect(matcher.match('1')).to.be.undefined\r\n\r\n\t\tmatcher.match('4').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('44')).to.be.undefined\r\n\r\n\t\tmatcher.match('44', { allowOverflow: true }).should.deep.equal({\r\n\t\t\toverflow: true\r\n\t\t})\r\n\t})\r\n\r\n\tit('should match a one-digit one-of set including a dash notation', function() {\r\n\t\tconst matcher = new PatternMatcher('[124-68]')\r\n\r\n\t\texpect(matcher.match('0')).to.be.undefined\r\n\r\n\t\tmatcher.match('1').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('2').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('3')).to.be.undefined\r\n\r\n\t\tmatcher.match('4').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('5').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('6').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('7')).to.be.undefined\r\n\r\n\t\tmatcher.match('8').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('9')).to.be.undefined\r\n\r\n\t\texpect(matcher.match('88')).to.be.undefined\r\n\r\n\t\tmatcher.match('88', { allowOverflow: true }).should.deep.equal({\r\n\t\t\toverflow: true\r\n\t\t})\r\n\t})\r\n\r\n\tit('should match a two-digit one-of set', function() {\r\n\t\tconst matcher = new PatternMatcher('[479][45]')\r\n\r\n\t\texpect(matcher.match('1')).to.be.undefined\r\n\r\n\t\tmatcher.match('4').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('5')).to.be.undefined\r\n\t\texpect(matcher.match('55')).to.be.undefined\r\n\r\n\t\tmatcher.match('44').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('444')).to.be.undefined\r\n\r\n\t\tmatcher.match('444', { allowOverflow: true }).should.deep.equal({\r\n\t\t\toverflow: true\r\n\t\t})\r\n\t})\r\n\r\n\tit('should match a two-digit one-of set (regular digit and a one-of set)', function() {\r\n\t\tconst matcher = new PatternMatcher('1[45]')\r\n\r\n\t\texpect(matcher.match('0')).to.be.undefined\r\n\r\n\t\tmatcher.match('1').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('15').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('16')).to.be.undefined\r\n\t})\r\n\r\n\tit('should match a pattern with an or group', function() {\r\n\t\tconst matcher = new PatternMatcher('7(?:1[0-68]|2[1-9])')\r\n\r\n\t\texpect(matcher.match('1')).to.be.undefined\r\n\r\n\t\tmatcher.match('7').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('71').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('73')).to.be.undefined\r\n\r\n\t\tmatcher.match('711').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('717')).to.be.undefined\r\n\r\n\t\texpect(matcher.match('720')).to.be.undefined\r\n\r\n\t\tmatcher.match('722').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('7222')).to.be.undefined\r\n\r\n\t\tmatcher.match('7222', { allowOverflow: true }).should.deep.equal({\r\n\t\t\toverflow: true\r\n\t\t})\r\n\t})\r\n\r\n\tit('should match an or pattern containing or groups', function() {\r\n\t\tconst matcher = new PatternMatcher('2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])')\r\n\r\n\t\texpect(matcher.match('1')).to.be.undefined\r\n\r\n\t\tmatcher.match('2').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('3').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('4')).to.be.undefined\r\n\r\n\t\texpect(matcher.match('21')).to.be.undefined\r\n\r\n\t\tmatcher.match('22').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('221')).to.be.undefined\r\n\r\n\t\tmatcher.match('222').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('2222')).to.be.undefined\r\n\r\n\t\tmatcher.match('2222', { allowOverflow: true }).should.deep.equal({\r\n\t\t\toverflow: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('3').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('33').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('332').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('333')).to.be.undefined\r\n\t})\r\n\r\n\tit('should match an or pattern', function() {\r\n\t\tconst matcher = new PatternMatcher('6|8')\r\n\r\n\t\texpect(matcher.match('5')).to.be.undefined\r\n\r\n\t\tmatcher.match('6').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('7')).to.be.undefined\r\n\r\n\t\tmatcher.match('8').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\t})\r\n\r\n\tit('should match an or pattern (one-of sets)', function() {\r\n\t\tconst matcher = new PatternMatcher('[123]|[5-8]')\r\n\r\n\t\texpect(matcher.match('0')).to.be.undefined\r\n\r\n\t\tmatcher.match('1').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('2').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('3').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('4')).to.be.undefined\r\n\r\n\t\tmatcher.match('5').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('6').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('7').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('8').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('9')).to.be.undefined\r\n\r\n\t\texpect(matcher.match('18')).to.be.undefined\r\n\r\n\t\tmatcher.match('18', { allowOverflow: true }).should.deep.equal({\r\n\t\t\toverflow: true\r\n\t\t})\r\n\t})\r\n\r\n\tit('should match an or pattern (different lengths)', function() {\r\n\t\tconst matcher = new PatternMatcher('60|8')\r\n\r\n\t\texpect(matcher.match('5')).to.be.undefined\r\n\r\n\t\tmatcher.match('6').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('60').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('61')).to.be.undefined\r\n\r\n\t\texpect(matcher.match('7')).to.be.undefined\r\n\r\n\t\tmatcher.match('8').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('68')).to.be.undefined\r\n\t})\r\n\r\n\tit('should match an or pattern (one-of sets) (different lengths)', function() {\r\n\t\tconst matcher = new PatternMatcher('[123]|[5-8][2-8]')\r\n\r\n\t\texpect(matcher.match('0')).to.be.undefined\r\n\t})\r\n\r\n\tit('should match an or pattern (one-of sets and regular digits) (different lengths)', function() {\r\n\t\tconst matcher = new PatternMatcher('[2358][2-5]|4')\r\n\r\n\t\texpect(matcher.match('0')).to.be.undefined\r\n\r\n\t\tmatcher.match('2').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('21')).to.be.undefined\r\n\r\n\t\tmatcher.match('22').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('25').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('26')).to.be.undefined\r\n\r\n\t\texpect(matcher.match('222')).to.be.undefined\r\n\r\n\t\tmatcher.match('222', { allowOverflow: true }).should.deep.equal({\r\n\t\t\toverflow: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('3').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('4').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('6')).to.be.undefined\r\n\t})\r\n\r\n\tit('should match an or pattern (one-of sets and regular digits mixed) (different lengths)', function() {\r\n\t\tconst matcher = new PatternMatcher('[2358]2|4')\r\n\r\n\t\texpect(matcher.match('0')).to.be.undefined\r\n\r\n\t\tmatcher.match('2').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('21')).to.be.undefined\r\n\r\n\t\tmatcher.match('22').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('222')).to.be.undefined\r\n\r\n\t\tmatcher.match('222', { allowOverflow: true }).should.deep.equal({\r\n\t\t\toverflow: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('3').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('4').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('6')).to.be.undefined\r\n\t})\r\n\r\n\tit('should match an or pattern (one-of sets groups and regular digits mixed) (different lengths)', function() {\r\n\t\tconst matcher = new PatternMatcher('1(?:11|[2-9])')\r\n\r\n\t\tmatcher.match('1').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('10')).to.be.undefined\r\n\r\n\t\tmatcher.match('11').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('111').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('1111')).to.be.undefined\r\n\r\n\t\tmatcher.match('1111', { allowOverflow: true }).should.deep.equal({\r\n\t\t\toverflow: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('12').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('122')).to.be.undefined\r\n\r\n\t\tmatcher.match('19').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('5')).to.be.undefined\r\n\t})\r\n\r\n\tit('should match nested or groups', function() {\r\n\t\tconst matcher = new PatternMatcher('1(?:2(?:3(?:4|5)|6)|7(?:8|9))0')\r\n\r\n\t\tmatcher.match('1').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('2')).to.be.undefined\r\n\r\n\t\texpect(matcher.match('11')).to.be.undefined\r\n\r\n\t\tmatcher.match('12').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('121')).to.be.undefined\r\n\r\n\t\tmatcher.match('123').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('1231')).to.be.undefined\r\n\r\n\t\tmatcher.match('1234').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('12340').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('123401')).to.be.undefined\r\n\r\n\t\tmatcher.match('123401', { allowOverflow: true }).should.deep.equal({\r\n\t\t\toverflow: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('12350').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('12360')).to.be.undefined\r\n\r\n\t\tmatcher.match('1260').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('1270')).to.be.undefined\r\n\r\n\t\texpect(matcher.match('1770')).to.be.undefined\r\n\r\n\t\tmatcher.match('1780').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('1790').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('18')).to.be.undefined\r\n\t})\r\n\r\n\tit('should match complex patterns', function() {\r\n\t\tconst matcher = new PatternMatcher('(?:31|4)6|51|6(?:5[0-3579]|[6-9])|7(?:20|32|8)|[89]')\r\n\r\n\t\texpect(matcher.match('0')).to.be.undefined\r\n\r\n\t\tmatcher.match('3').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('31').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('32')).to.be.undefined\r\n\r\n\t\tmatcher.match('316').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('315')).to.be.undefined\r\n\r\n\t\tmatcher.match('4').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('46').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('47')).to.be.undefined\r\n\r\n\t\tmatcher.match('5').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('50')).to.be.undefined\r\n\r\n\t\tmatcher.match('51').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('6').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('64')).to.be.undefined\r\n\r\n\t\tmatcher.match('65').should.deep.equal({\r\n\t\t\tpartialMatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('650').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\texpect(matcher.match('654')).to.be.undefined\r\n\r\n\t\tmatcher.match('69').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('8').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\r\n\t\tmatcher.match('9').should.deep.equal({\r\n\t\t\tmatch: true\r\n\t\t})\r\n\t})\r\n})"],"file":"AsYouTypeFormatter.PatternMatcher.test.js"}
|
|
@@ -8,6 +8,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
8
8
|
|
|
9
9
|
import { DIGIT_PLACEHOLDER, countOccurences, repeat, cutAndStripNonPairedParens, closeNonPairedParens, stripNonPairedParens, populateTemplateWithDigits } from './AsYouTypeFormatter.util';
|
|
10
10
|
import formatCompleteNumber, { canFormatCompleteNumber } from './AsYouTypeFormatter.complete';
|
|
11
|
+
import PatternMatcher from './AsYouTypeFormatter.PatternMatcher';
|
|
11
12
|
import parseDigits from './helpers/parseDigits';
|
|
12
13
|
export { DIGIT_PLACEHOLDER } from './AsYouTypeFormatter.util';
|
|
13
14
|
import { FIRST_GROUP_PATTERN } from './helpers/formatNationalNumberUsingFormat';
|
|
@@ -167,6 +168,13 @@ function () {
|
|
|
167
168
|
this.matchingFormats = [];
|
|
168
169
|
}
|
|
169
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Formats an updated phone number.
|
|
173
|
+
* @param {string} nextDigits — Additional phone number digits.
|
|
174
|
+
* @param {object} state — `AsYouType` state.
|
|
175
|
+
* @return {[string]} Returns undefined if the updated phone number can't be formatted using any of the available formats.
|
|
176
|
+
*/
|
|
177
|
+
|
|
170
178
|
}, {
|
|
171
179
|
key: "format",
|
|
172
180
|
value: function format(nextDigits, state) {
|
|
@@ -328,25 +336,51 @@ function () {
|
|
|
328
336
|
|
|
329
337
|
if (leadingDigitsPatternsCount === 0) {
|
|
330
338
|
return true;
|
|
331
|
-
} // Start
|
|
339
|
+
} // Start narrowing down the list of possible formats based on the leading digits.
|
|
340
|
+
// (only previously matched formats take part in the narrowing down process)
|
|
341
|
+
// `leading_digits_patterns` start with 3 digits min
|
|
342
|
+
// and then go up from there one digit at a time.
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
leadingDigitsPatternIndex = Math.min(leadingDigitsPatternIndex, leadingDigitsPatternsCount - 1);
|
|
346
|
+
var leadingDigitsPattern = format.leadingDigitsPatterns()[leadingDigitsPatternIndex]; // Google imposes a requirement on the leading digits
|
|
347
|
+
// to be minimum 3 digits long in order to be eligible
|
|
348
|
+
// for checking those with a leading digits pattern.
|
|
349
|
+
//
|
|
350
|
+
// Since `leading_digits_patterns` start with 3 digits min,
|
|
351
|
+
// Google's original `libphonenumber` library only starts
|
|
352
|
+
// excluding any non-matching formats only when the
|
|
332
353
|
// national number entered so far is at least 3 digits long,
|
|
333
354
|
// otherwise format matching would give false negatives.
|
|
355
|
+
//
|
|
334
356
|
// For example, when the digits entered so far are `2`
|
|
335
357
|
// and the leading digits pattern is `21` –
|
|
336
358
|
// it's quite obvious in this case that the format could be the one
|
|
337
359
|
// but due to the absence of further digits it would give false negative.
|
|
338
|
-
|
|
360
|
+
//
|
|
361
|
+
// Also, `leading_digits_patterns` doesn't always correspond to a single
|
|
362
|
+
// digits count. For example, `60|8` pattern would already match `8`
|
|
363
|
+
// but the `60` part would require having at least two leading digits,
|
|
364
|
+
// so the whole pattern would require inputting two digits first in order to
|
|
365
|
+
// decide on whether it matches the input, even when the input is "80".
|
|
366
|
+
//
|
|
367
|
+
// This library — `libphonenumber-js` — allows filtering by `leading_digits_patterns`
|
|
368
|
+
// even when there's only 1 or 2 digits of the national (significant) number.
|
|
369
|
+
// To do that, it uses a non-strict pattern matcher written specifically for that.
|
|
370
|
+
//
|
|
339
371
|
|
|
340
372
|
if (leadingDigits.length < MIN_LEADING_DIGITS_LENGTH) {
|
|
341
|
-
return
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
373
|
+
return new PatternMatcher(leadingDigitsPattern).match(leadingDigits, {
|
|
374
|
+
allowOverflow: true
|
|
375
|
+
}) !== undefined; // Before leading digits < 3 matching was implemented:
|
|
376
|
+
// return true
|
|
377
|
+
} // If at least `MIN_LEADING_DIGITS_LENGTH` digits of a national number are
|
|
378
|
+
// available then use the usual regular expression matching.
|
|
379
|
+
//
|
|
380
|
+
// The whole pattern is wrapped in round brackets (`()`) because
|
|
381
|
+
// the pattern can use "or" operator (`|`) at the top level of the pattern.
|
|
382
|
+
//
|
|
346
383
|
|
|
347
|
-
leadingDigitsPatternIndex = Math.min(leadingDigitsPatternIndex, leadingDigitsPatternsCount - 1);
|
|
348
|
-
var leadingDigitsPattern = format.leadingDigitsPatterns()[leadingDigitsPatternIndex]; // Brackets are required for `^` to be applied to
|
|
349
|
-
// all or-ed (`|`) parts, not just the first one.
|
|
350
384
|
|
|
351
385
|
return new RegExp("^(".concat(leadingDigitsPattern, ")")).test(leadingDigits);
|
|
352
386
|
}
|