Skip to content

plughacker/card-validator

Repository files navigation

Card Validator

CI

A simple card validator based on the Braintree validator

Getting Started

  1. Install the card-validator 💳
yarn add @malga/card-validator
# or
npm install @malga/card-validator
  1. 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
}
*/

Contributing

Feel free to contribute to this project by submitting pull requests, creating documentation, or bringing ideas to make the project even better!