How to use banks-db - 1 common examples

To help you get started, we’ve selected a few banks-db examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gretchenfitze / billing-form / src / index.js View on Github external
cardNumber.addEventListener('input', (event) => {
  const number = event.target.value;
  const bank = banksDB(number);

  if (number.length >= 14) {
    const isLuhnCheckPassed = luhn(number.split(' ').join(''));
    cardNumber.classList.toggle('card__input_invalid', !isLuhnCheckPassed);
    cardNumber.classList.toggle('card__input_valid', isLuhnCheckPassed);
  } else {
    cardNumber.classList.remove('card__input_invalid', 'card__input_valid');
  }

  if (bank.code) {
    billingForm.classList.add(`card_bank-${(bank.code || 'other')}`);
    bankName.innerText = bank.country === 'ru' ? bank.localTitle : bank.engTitle;
  } else {
    billingForm.className = 'card';
    bankName.innerText = '';
  }

banks-db

Bankcards BIN database

CC-BY-4.0
Latest version published 2 years ago

Package Health Score

53 / 100
Full package analysis

Popular banks-db functions