File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 22
33> Regular expression for matching credit card numbers
44
5+
56## Install
67
7- ``` sh
8+ ```
89$ npm install --save credit-card-regex
910```
1011
12+
1113## Usage
1214
1315``` js
@@ -26,6 +28,22 @@ creditCardRegex({exact: true}).test('6011881485017922');
2628// => ['6011881485017922', '5441068611005540']
2729```
2830
31+
32+ ## API
33+
34+ ### creditCardRegex(options)
35+
36+ Returns a regex for matching credit card numbers.
37+
38+ #### options.exact
39+
40+ Type: ` boolean `
41+ Default: ` false ` * (Matches any credit card number in a string)*
42+
43+ Only match an exact string.
44+ Useful with ` RegExp#test ` to check if a string is a credit card number.
45+
46+
2947## License
3048
3149MIT © [ Kevin Mårtensson] ( https://github.com/kevva )
Original file line number Diff line number Diff line change 11'use strict' ;
22
3- var creditCardRegex = require ( '../' ) ;
43var test = require ( 'ava' ) ;
4+ var creditCardRegex = require ( '../' ) ;
55
66test ( 'match credit card numbers' , function ( t ) {
77 var fixtures = [ ] . concat (
You can’t perform that action at this time.
0 commit comments