File tree Expand file tree Collapse file tree 2 files changed +2
-9
lines changed Expand file tree Collapse file tree 2 files changed +2
-9
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
2-
32var americanExpress = '(?:3[47][0-9]{13})' ;
43var dinersClub = '(?:3(?:0[0-5]|[68][0-9])[0-9]{11})' ;
54var discover = '(?:6(?:011|5[0-9]{2})(?:[0-9]{12}))' ;
@@ -12,7 +11,7 @@ function generate(pattern) {
1211 return function ( opts ) {
1312 opts = opts || { } ;
1413 return opts . exact ? new RegExp ( '(?:^' + pattern + '$)' ) :
15- new RegExp ( '(?:^|\\s)?( ["\'])?' + pattern + '\\1' , 'g' ) ;
14+ new RegExp ( '(["\'])?' + pattern + '\\1' , 'g' ) ;
1615 } ;
1716}
1817
Original file line number Diff line number Diff line change 11'use strict' ;
2-
32var test = require ( 'ava' ) ;
43var creditCardRegex = require ( '../' ) ;
54
@@ -15,12 +14,7 @@ test('match credit card numbers', function (t) {
1514 ) ;
1615
1716 fixtures . forEach ( function ( el ) {
18- if ( ! creditCardRegex ( ) . exec ( el ) ) {
19- t . assert ( false , el ) ;
20- return ;
21- }
22-
23- t . assert ( creditCardRegex ( ) . exec ( el ) [ 0 ] === el , el ) ;
17+ t . assert ( creditCardRegex ( { exact : true } ) . test ( el ) , el ) ;
2418 } ) ;
2519
2620 t . end ( ) ;
You can’t perform that action at this time.
0 commit comments