Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

credit-card-type

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

credit-card-type

A library for determining credit card type

  • 10.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
659K
increased by8.94%
Maintainers
1
Weekly downloads
 
Created

What is credit-card-type?

The credit-card-type npm package is used to detect the type of a credit card based on its number. It can identify various card types such as Visa, MasterCard, American Express, and more. This package is useful for validating and formatting credit card information in web applications.

What are credit-card-type's main functionalities?

Detect Card Type

This feature allows you to detect the type of a credit card based on its number. The code sample demonstrates how to use the package to identify a Visa card.

const creditCardType = require('credit-card-type');
const cardInfo = creditCardType('4111111111111111');
console.log(cardInfo);

Get Card Type by Name

This feature allows you to get detailed information about a specific card type by its name. The code sample shows how to retrieve information about Visa cards.

const creditCardType = require('credit-card-type');
const visaCard = creditCardType.getTypeInfo('visa');
console.log(visaCard);

Add Custom Card Type

This feature allows you to add a custom card type to the list of recognized card types. The code sample demonstrates how to add a custom card type and detect it using the package.

const creditCardType = require('credit-card-type');
creditCardType.addCard({
  niceType: 'My Custom Card',
  type: 'mycustomcard',
  patterns: [1234],
  gaps: [4, 8, 12],
  lengths: [16],
  code: { name: 'CVV', size: 3 }
});
const customCardInfo = creditCardType('1234567812345678');
console.log(customCardInfo);

Other packages similar to credit-card-type

FAQs

Package last updated on 18 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc