credit-card-get-brand
☁️ Installation
# Using npm
npm install --save credit-card-get-brand
# Using yarn
yarn add credit-card-get-brand
📋 Example
From the card number, return the brand
var creditCard = require("credit-card-get-brand");
const cardNumber = "4111111111111111"; // Visa
const brand = creditCard.getBrand(cardNumber);
console.log(brand);
/* Output:
{
code: 'visa',
name: 'Visa',
image: 'https://i.im.ge/2022/08/06/FcJsAy.visa.png'
}
*/
🔍 API
getBrand(cardNumber: String)
getBrand
will return an objects with the following data:
Key | Type | Description |
---|---|---|
name | String | Brand name |
code | String | Brand unique identification |
image | String | Brand image link |
Accepted brands
- ELO
- MASTERCARD
- MAESTRO
- AMEX
- DISCOVER
- DINERS
- JCB
- HIPERCARD
- VISA