timofei-iatsenko / angular-cc-library

Library to support Credit Card input masking and validation
MIT License
82 stars 71 forks source link

Let extend card types #46

Open liverday opened 5 years ago

liverday commented 5 years ago

Hi, i'm Vitor and i'm from Brazil. We have some credit cards that doesn't exist in this library. There is a way to extend the actual cardTypes array? This will help me a lot.

Thanks!

charlesartbr commented 2 years ago

This worked for me as a workaround to include Hipercard:

import { CreditCard } from 'angular-cc-library';

const cards = CreditCard.cards();

cards.unshift({
  type: 'hipercard',
  patterns: [606282],
  format: /(\d{1,4})/g,
  length: [16],
  cvvLength: [3],
  luhn: true,
})

CreditCard.cards = () => cards;