1.3.0 • Published 3 years ago

ibanjs-aion v1.3.0

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

ibanjs-aion

ibanjs-aion is node package based on 'ibankit-js'

Installation

npm i ibanjs-aion

Usage

import { IBAN } from 'ibanjs-aion'

IBAN.isValid("AT611904300234573201") // ===  true
IBAN.isValid("DE89 3704 0044 0532 0130 00") // == true
IBAN.isValid("hello world"); // == false

Examples

  • IBAN
  • BIC

IBAN examples

import { CountryCode, IBANBuilder, IBAN } from 'ibanjs-aion'

// How to generate IBAN
const ibanStr = new IBANBuilder()
  .countryCode(CountryCode.BH)
  .bankCode("BMAG")
  .accountNumber("00001299123456")
  .build()
  .toString()

// How to create IBAN object from String
const iban = new IBAN("DE89370400440532013000")
 
// The library ignores spaces in IBANs, this is valid
const iban = new IBAN("DE89 3704 0044 0532 0130 00")

// For testing, the library will also generate random IBANs
const iban = IBAN.random(CountryCode.AT)
const iban = IBAN.random()
const iban = new IBANBuilder()
  .countryCode(CountryCode.AT)
  .bankCode("19043")
  .build()

// you can quickly check validity
IBAN.isValid("AT611904300234573201"); // ===  true
IBAN.isValid("DE89 3704 0044 0532 0130 00"); // == true
IBAN.isValid("hello world"); // == false

BIC Example

import { BIC } from 'ibanjs-aion'

// How to create BIC object from String
const bic = new BIC("DEUTDEFF")
 
// Check to see is BIC code is valid
BIC.isValid("DEUTDEFF50")

Test Cases

npm test

// single test
npm test -- Bic