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

@randajan/iban

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@randajan/iban

'IBAN tools'

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Node @randajan/iban

NPM Version License

This library provides utility functions for validating and formatting International Bank Account Numbers (IBAN) using iso-7064 lib.

Installation

Install the package using npm:

npm install @randajan/iban

or

yarn add @randajan/iban

Usage

Import the necessary functions from the @randajan/iban package:

import { validateIBAN, formatIBAN, getIBAN } from '@randajan/iban';

validateIBAN(iban)

This function validates the given IBAN.

Parameters:

  • iban (string): The IBAN to validate.

Returns:

  • true if the IBAN is valid.
  • false if the IBAN is invalid.

formatIBAN(iban)

This function formats the given IBAN by adding spaces every 4 characters.

Parameters:

  • iban (string): The IBAN to format.

Returns:

  • The formatted IBAN string with spaces every 4 characters.

getIBAN(country, bank, account, format = false)

This function generates a valid IBAN for the specified country, bank, and account details.

Parameters:

  • country (string): The country code (e.g., "GB", "DE").
  • bank (string): The bank code.
  • account (string): The account number.
  • format (boolean): Optional. If true, the generated IBAN will be formatted with spaces every 4 characters (default is false).

Returns:

  • The generated valid IBAN string.

Examples

import { validateIBAN, formatIBAN, getIBAN } from 'iban-utils';

const iban = 'GB32WEAK12345612345678';

console.log(validateIBAN(iban));  // Output: true
console.log(formatIBAN(iban));    // Output: 'GB32 WEAK 1234 5612 3456 78'

const generatedIBAN = getIBAN('GB', 'WEAK123456', '12345678', true);
console.log(generatedIBAN);      // Output: 'GB32 WEAK 1234 5612 3456 78'

License

This project is licensed under the MIT License - see the LICENSE file for details.

Keywords

FAQs

Package last updated on 11 Jul 2023

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