0.0.54 • Published 5 months ago

@rivo-gg/geld v0.0.54

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

@rivo-gg/geld

A comprehensive TypeScript/JavaScript library for financial operations and validations. Currently featuring IBAN (International Bank Account Number) validation and formatting, with more financial tools planned for future releases.

Coverage

'Geld' means 'money' in German, Dutch and Afrikaans. That's why we chose that name for our financial tools.

Installation

npm install @rivo-gg/geld
# or
yarn add @rivo-gg/geld
# or
pnpm add @rivo-gg/geld

Features

  • IBAN validation using MOD 97 algorithm
  • IBAN formatting for display
  • Support for all standard IBAN formats
  • Zero dependencies
  • TypeScript support

Usage

import { iban } from "@rivo-gg/geld";

// Validate an IBAN
const isValid = iban.isValid("DE89370400440532013000");
console.log(isValid); // true

// Format an IBAN for display (with default space separator)
const formatted = iban.printFormat("DE89370400440532013000");
console.log(formatted); // 'DE89 3704 0044 0532 0130 00'

// Format with custom separator
const customFormatted = iban.printFormat("DE89370400440532013000", "-");
console.log(customFormatted); // 'DE89-3704-0044-0532-0130-00'

// Validate with automatic cleaning (removes spaces and special characters)
const isValidWithCleaning = iban.isValid("DE89 3704 0044 0532 0130 00", true);
console.log(isValidWithCleaning); // true

API Reference

iban.isValid(input: string, clean?: boolean): boolean

Validates an IBAN using the MOD 97 algorithm.

  • input: The IBAN string to validate
  • clean: (optional) Whether to clean the IBAN before validation (removes spaces and special characters). Defaults to false
  • Returns: boolean - true if the IBAN is valid, false otherwise

iban.printFormat(iban: string, separator?: string): string

Formats an IBAN for display purposes.

  • iban: The IBAN string to format
  • separator: (optional) The separator to use between groups. Defaults to space (' ')
  • Returns: string - The formatted IBAN

License

MIT © Rivo

0.0.54

5 months ago

0.0.53

5 months ago

0.0.52

5 months ago

0.0.51

5 months ago

0.0.50

5 months ago

0.0.49

5 months ago

0.0.48

5 months ago

0.0.47

6 months ago

0.0.46

6 months ago

0.0.45

6 months ago

0.0.43

6 months ago

0.0.42

6 months ago

0.0.41

6 months ago

0.0.4

6 months ago

0.0.3

6 months ago

0.0.2

6 months ago

0.0.1

6 months ago