JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q63109F
  • License MIT

Lightweight npm library that provides different financial validators

Package Exports

  • valifino
  • valifino/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (valifino) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Valifino

npm package Build Status Downloads Issues Code Coverage Commitizen Friendly Semantic Release

A comprehensive library of financial validators for Node.js, built using TypeScript. This library provides a set of functions to validate various financial instruments and formats such as credit card numbers, IBANs, SWIFT/BIC codes, and more.

Install

npm install valifino

Features

  • Validate credit card numbers using the Luhn algorithm
  • Validate CVV codes for various card types
  • Validate expiration dates of credit cards
  • Validate IBANs for multiple countries [TBD]
  • Validate SWIFT/BIC codes [TBD]
  • Validate routing numbers (e.g., ABA routing numbers) [TBD]
  • Validate bank account numbers [TBD]
  • Validate currency codes [TBD]
  • Validate transaction amounts [TBD]
  • Validate cryptocurrency addresses (e.g., Bitcoin, Ethereum) [TBD]

API

isValidCreditCardNumber(cardNumber: string): boolean

Validates a credit card number using the Luhn algorithm.

Example:

import { isValidCreditCardNumber} from 'valifino';

/**
 * @param cardNumber - The card number in string format.
 * @returns True if the card number is valid, false otherwise.
 */
isValidCreditCardNumber('4111111111111111'); // => true

isValidCVV(cardType: string, cvv: string): boolean

Validates the CVV code of a credit card based on the card type.

Example:

import { isValidCVV } from 'valifino';

/**
 * Validates the CVV code for the given card type.
 * @param cvv - The CVV code to validate.
 * @param cardType - The type of the card (e.g., CardType.Visa, CardType.MasterCard).
 * @returns True if the CVV is valid, false otherwise.
 */
isValidCVV(123, 'Visa'); // => true
isValidCVV(432, 'Amex'); // => false

isValidExpirationDate(expirationDate: string): boolean

Validates the expiration date of a credit card.

import { isValidExpirationDate } from 'valifino';

/**
 * @param expirationDate - The expiration date in the format MM/YY or MM/YYYY.
 * @returns True if the expiration date is valid, false otherwise.
 */
isValidExpirationDate('12/2023'); // => true
isValidExpirationDate('01-2025'); // => false

isValidIBAN [TBD]

isValidSWIFTBIC [TBD]

isValidRoutingNumber [TBD]

isValidAccountNumber [TBD]

isValidCurrencyCode [TBD]

isValidTransactionAmount [TBD]

isValidCryptoAddress [TBD]