A simple card validator based on the Braintree validator
- Install the
card-validator
💳
yarn add @malga/card-validator
# or
npm install @malga/card-validator
- Now just validate your cards
import cardValidator from '@malga/card-validator'
cardValidator.number('6274160007029307')
/*
{
card: {
niceType: 'VR',
type: 'vr',
patterns: [ 627416, 637036 ],
gaps: [],
lengths: [ 16 ],
code: { name: 'CVV', size: 3 },
matchStrength: 6
},
isPotentiallyValid: true,
isValid: true
}
*/
Feel free to contribute to this project by submitting pull requests, creating documentation, or bringing ideas to make the project even better!