File: cc.md

package info (click to toggle)
node-chance 2.2.6%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,612 kB
  • sloc: javascript: 16,572; makefile: 4
file content (37 lines) | stat: -rw-r--r-- 732 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# cc

```js
// usage
chance.cc()
chance.cc({type: 'Mastercard'})
```

<p class="pullquote" data-pullquote='Somewhat obvious warning: Do not use this to hit live payment gateways...' markdown="1"></p>

Generate a random credit card number. This card number will pass the
[Luhn algorithm][Luhn] so it looks like a legit card.

```js
chance.cc();
=> '6304038511073827'
```

Optionally specify a particular type of card to return:

```js
chance.cc({type: 'Mastercard'});
=> '5171206237468496'
```

The type can be specified by the long name, or by the short name:

```js
chance.cc({type: 'mc'});
=> '5103820202214116'
```


The [types][types] are enumerated below.

[Luhn]: http://en.wikipedia.org/wiki/Luhn_algorithm
[types]: #cc_type