Skip to content
This repository has been archived by the owner on Aug 23, 2024. It is now read-only.

kuronekouwu/bank-account-formatter

Repository files navigation

Bank account formatter

A simple format bank account address to look pretty 🤠 hotbling_meme

Look pretty good huh

Feature

  • Parse bank account to look pretty
  • Typescript support

Installtion

# NPM
npm install @mrwan2546/bank-account-formatter
# Yan
yarn add @mrwan2546/bank-account-formatter
# PNPM
pnpm install @mrwan2546/bank-account-formatter

Example useage

const { parse } = require("./dist")

const VALUE = "0488711222"
console.log(`KBANK result: ${parse(VALUE, "kbank")}`); // KBANK result: 048-8-71122-2
console.log(`SCB result: ${parse(VALUE, "scb")}`); // SCB result: 048-8-71122-2
console.log(`KTB result: ${parse(VALUE, "ktb")}`);  // KTB result: 048-8-71122-2

// Or you can set strict mode to true if you not want someone has human error input
// Input length 12
console.log(`GSB result: ${parse(VALUE + '21', "gsb", true)}`); // GSB result: 048-8-71122-221
// Input length 10, But GSB need input length 12 digist
console.log(`GSB result: ${parse(VALUE, "gsb", true)}`); // GSB result: null
// Input length 5, But BAAC need input length 10 digist
console.log(`KBANK result: ${parse('12345', "kbank", true)}`); // KBANK result: null
 // Input length 3 + aplhabet, But any bank doesn't support aplhabet account address  
console.log(`KBANK result: ${parse('abc', "kbank", true)}`); // KBANK result: null

Reference

LICENSE

MIT

Releases

No releases published

Packages

No packages published