What is iban?
The 'iban' npm package provides utilities for validating, formatting, and generating International Bank Account Numbers (IBANs). It is useful for financial applications that need to handle IBANs in a standardized way.
What are iban's main functionalities?
Validation
This feature allows you to validate whether a given IBAN is correct. The code sample checks if the provided IBAN is valid and returns a boolean value.
const iban = require('iban');
const isValid = iban.isValid('DE89370400440532013000');
console.log(isValid); // true
Formatting
This feature formats an IBAN into a more readable form by adding spaces. The code sample demonstrates how to format an IBAN string.
const iban = require('iban');
const formattedIban = iban.printFormat('DE89370400440532013000');
console.log(formattedIban); // 'DE89 3704 0044 0532 0130 00'
Generation
This feature generates an IBAN from a given Basic Bank Account Number (BBAN) and country code. The code sample shows how to generate an IBAN from a BBAN.
const iban = require('iban');
const generatedIban = iban.fromBBAN('DE', '370400440532013000');
console.log(generatedIban); // 'DE89370400440532013000'
Other packages similar to iban
ibantools
The 'ibantools' package provides similar functionalities for validating and formatting IBANs. It also includes additional features like generating IBANs from BBANs and country codes. Compared to 'iban', 'ibantools' offers a more comprehensive set of tools for handling IBANs.
iban.js
IBAN and BBAN validation, formatting and conversion in Javascript.
Check the demo on demo page to try it.
IBAN.js follows the ISO 13616 IBAN Registry technical specification.
Usage
IBAN.js is compatible with both commonjs and AMD module definition. It can be used as a node.js module and in the browser. It also has a bower manifest, a Typescript definition and a Meteor wrapper.
In node.js
var IBAN = require('iban');
IBAN.isValid('hello world');
IBAN.isValid('BE68539007547034');
In the browser
Using a module loader (AMD or commonjs) or directly through the global IBAN
object:
<script src="iban.js"></script>
<script>
IBAN.isValid('hello world');
IBAN.isValid('BE68539007547034');
</script>
With TypeScript
The library is also available from the typescript language. To do this, download the definition and add a reference to this:
IBAN.isValid('hello world');
IBAN.isValid('BE68539007547034');
With Meteor framework
A wrapper package for the Meteor framework is available here.
API
* isValid(iban)
* toBBAN(iban, separator)
* fromBBAN(countryCode, bban)
* isValidBBAN(countryCode, bban)
* printFormat(iban, separator)
* electronicFormat(iban)