@types/creditcardutils
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Installation

npm install --save @types/creditcardutils

Summary

This package contains type definitions for creditcardutils (https://github.com/faaez/creditcardutils#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/creditcardutils.

index.d.ts

/**
 * Validates a credit card number. Returns a boolean.
 */
export function validateCardNumber(cardNumber: string): boolean;

/**
 * Takes an unformatted credit card number and returns a formatted string.
 */
export function formatCardNumber(unformatted: string): string;

/**
 * Gets credit card type from its number. Returns a string.
 */
export function parseCardType(cardNumber: string): string;

/**
 * Validates a credit card expiry. Returns a boolean.
 */
export function validateCardExpiry(month: string, year: string): boolean;

/**
 * Gets credit card expiration from its date. Returns a formatted string of the shape MM / YY.
 */
export function formatCardExpiry(expiration: string): string;

/**
 * Parses credit card expiration from the date. Returns an object of the shape { month: 4, year: 2021 }.
 */
export function parseCardExpiry(expiration: string): object;

/**
 * Validates a credit card CVC. Returns a boolean.
 */
export function validateCardCVC(cvc: string, type?: string): boolean;

// /**
//  * Validates a credit card CVC. Returns a boolean.
//  */
// export function validateCardCVC(cvc: string, type: string): boolean;

export as namespace creditcardutils;

Additional Details

  • Last updated: Mon, 06 Nov 2023 22:41:05 GMT
  • Dependencies: none

Credits

These definitions were written by Steven Conaway.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/creditcardutils

Weekly Downloads

1,900

Version

1.0.2

License

MIT

Unpacked Size

4.97 kB

Total Files

5

Last publish

Collaborators

  • types