victorquinn/chancejs — pull request #8 by TimPetricola (2013-07-02 23:24:54+00:00)
Title: Added credit card methods

Methods added:
* `chance.cc_number(options)`
* `chance.cc_types()`
* `chance.cc_type(options)`
* `chance.luhn_check(number)`

I don't really like the `cc_` prefix and the fact that `luhn_check()` is publicly accessible. I didn't find any better solution but I'm open to any suggestion :)

Considerations:
* Every generated number will be checked against [Luhn algorithm](http://en.wikipedia.org/wiki/Luhn_algorithm) even if the type doesn't require it(e.g. China UnionPay, Diners Club enRoute).
* Every card type only has one possible prefix and one possible length even if in reality there are more possibilities (check [Bank Card Number: Issuer Identification Number](http://en.wikipedia.org/wiki/Bank_card_number#Issuer_identification_number_.28IIN.29) for more information).