Socket
Socket
Sign inDemoInstall

s-creditcard

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

s-creditcard

Returns credit card type given a number


Version published
Weekly downloads
41
increased by925%
Maintainers
1
Weekly downloads
 
Created
Source

s-creditcard

NPM version Dependencies build status NPM license

Installation

npm install --save s-creditcard

Usage

Input a credit card number (as a string) and it returns the type of credit card. Incomplete inputs will also return successfully for the following card types:

  • visa
  • amex
  • mastercard
  • discover
  • jcb
card('4242424242424242') // returns 'visa'
Supported card types
  • Visa (visa)
  • Mastercard (mastercard)
  • Discover (discover)
  • American Express (amex)
  • Diners Club (dinersClub)
  • JCB (jcb)
  • Carte Blanche (carteBlanche)
  • Unionpay (unionpay)
  • Lasercard (lasercard)
  • Solo (solo)
  • Maestro (maestro)

All other valid credit cards return other. Invalid credit cards return none. Be sure to trim whitespace and remove non-numeric characters from the credit card number.

Keywords

FAQs

Package last updated on 26 Jan 2018

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