npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

bank-helper

v0.1.3

Published

Kumpulan helper untuk aplikasi perbankan seperti format Rupiah, format Gram, dan utilitas lainnya.

Readme

bank-helper

Kumpulan helper untuk aplikasi perbankan seperti format Rupiah, format Gram, dan utilitas lainnya.

Instalasi

npm install bank-helper

Demo

Demo di CodeSandbox

Import

import {
  formatRupiah,
  formatGram,
  pembulatan,
  sortBy,
  capitalize,
  convertDate,
  getToday,
  doEncrypt,
  doDecrypt,
  generateRandomUUID
} from 'bank-helper';

Daftar Fitur & Contoh Penggunaan

Format Rupiah

Format angka ke mata uang Rupiah.

formatRupiah(123456789); // "123.456.789"
formatRupiah(123456789, { withRp: true }); // "Rp123.456.789"
formatRupiah(5, { terbilang: true }); // "lima"
formatRupiah(5, { terbilang: true, capitalize: true }); // "Lima"
formatRupiah(1300000000, { terbilang: true }); // "satu miliar tiga ratus juta"

Format Gram

Format angka ke satuan gram dengan 3 digit desimal dan pemisah ribuan.

formatGram(1234.5); // "1,234.500"
formatGram("98765.4321"); // "98,765.432"

Pembulatan Harga

Membulatkan harga ke kelipatan nominal terdekat.

pembulatan(1234, 500); // 1500
pembulatan(1234, 500, 'BAWAH'); // 1000

Sort Array Objek

Mengurutkan array objek berdasarkan properti tertentu dan urutan.

sortBy([{a:2},{a:1}], 'a'); // [{a:1},{a:2}]
sortBy([{a:2},{a:1}], 'a', 'desc'); // [{a:2},{a:1}]

Kapitalisasi Kata

Mengubah huruf pertama setiap kata menjadi kapital.

capitalize('bank helper indonesia'); // "Bank Helper Indonesia"

Format Tanggal Custom

Konversi tanggal ke format custom, mendukung format Indonesia dan penambahan hari.

convertDate({
  value: new Date('2025-08-14'),
  format: 'DD-MM-YYYY',
  indonesian: true,
  showDay: true
}); // "Kamis 14-Agustus-2025"

getToday({
  format: 'DD-MM-YYYY',
  indonesian: true,
  showDay: true
}); // "Hari ini dalam format Indonesia"

Enkripsi & Dekripsi Data

Enkripsi dan dekripsi data string/object dengan algoritma custom.

const encrypted = doEncrypt({ data: 'BANK123', key: 'key123', mode: '1' });
const decrypted = doDecrypt({ data: encrypted, key: 'key123', mode: '1' });

Generate UUID Unik

Membuat string unik mirip UUID.

generateRandomUUID(); // "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

Contoh Lengkap

import {
  formatRupiah,
  formatGram,
  pembulatan,
  sortBy,
  capitalize,
  convertDate,
  getToday,
  doEncrypt,
  doDecrypt,
  generateRandomUUID
} from 'bank-helper';

console.log(formatRupiah(1000000)); // "1,000,000"
console.log(formatGram(1500)); // "1,500.000"
console.log(pembulatan(1234, 500)); // 1500
console.log(sortBy([{a:2},{a:1}], 'a')); // [{a:1},{a:2}]
console.log(capitalize('bank helper indonesia')); // "Bank Helper Indonesia"
console.log(convertDate({ value: new Date(), format: 'DD-MM-YYYY', indonesian: true, showDay: true })); // "Rabu 14-Agustus-2025"
console.log(getToday({ format: 'DD-MM-YYYY', indonesian: true, showDay: true })); // "Rabu 14-Agustus-2025"
const encrypted = doEncrypt({ data: 'BANK123', key: 'key123', mode: '1' });
console.log('Encrypted:', encrypted); // Contoh: "4A4B4E313233"
console.log('Decrypted:', doDecrypt({ data: encrypted, key: 'key123', mode: '1' })); // "BANK123"
console.log(generateRandomUUID()); // "a1b2c3d4-e5f6-7890-abcd-ef1234567890"

Test

Jalankan contoh semua helper:

npm run example

Lisensi

MIT


Dokumentasi Fungsi

formatRupiah

Format angka ke mata uang Rupiah, dengan opsi tambahan.

formatRupiah(1000000); // "1,000,000"
formatRupiah(1000000, { withRp: true }); // "Rp1,000,000"
formatRupiah(1300000000, { terbilang: true }); // "satu miliar tiga ratus juta"
formatRupiah(1300000000, { terbilang: true, capitalize: true }); // "Satu Miliar Tiga Ratus Juta"

Parameter:

  • value: number
  • options (optional):
    • withRp: boolean (tambahkan prefix "Rp")
    • terbilang: boolean (tampilkan terbilang)
    • capitalize: boolean (kapitalisasi hasil terbilang)

formatGram

Memformat berat menjadi string dengan 3 digit desimal dan pemisah ribuan.

formatGram(1234.5); // "1,234.500"
formatGram("98765.4321"); // "98,765.432"

Parameter:

  • berat: string | number
  • format: number (default 3)

pembulatan

Membulatkan harga ke kelipatan nominal terdekat.

pembulatan(1234, 500); // 1500
pembulatan(1234, 500, 'BAWAH'); // 1000

Parameter:

  • nominal: number
  • nominalPembulatan: number
  • type: 'ATAS' | 'BAWAH' (default 'ATAS')

sortBy

Mengurutkan array objek berdasarkan properti tertentu dan urutan.

sortBy([{a:2},{a:1}], 'a'); // [{a:1},{a:2}]
sortBy([{a:2},{a:1}], 'a', 'desc'); // [{a:2},{a:1}]

Parameter:

  • array: any[]
  • key: string
  • order: 'asc' | 'desc' (default 'asc')

convertDate

Konversi tanggal ke format custom, mendukung format Indonesia dan penambahan hari.

convertDate({ value: new Date(), format: 'DD-MM-YYYY', indonesian: true, showDay: true });

Parameter:

  • value: string | number | Date
  • withTime?: boolean
  • format?: string
  • dayOffset?: number
  • indonesian?: boolean
  • showDay?: boolean

getToday

Mengambil tanggal hari ini dengan format custom.

getToday({ format: 'DD-MM-YYYY', indonesian: true, showDay: true });

Parameter:

  • Sama seperti convertDate, semua opsional

doEncrypt

Enkripsi data string/object dengan algoritma custom.

const encrypted = doEncrypt({ data: 'BANK123', key: 'key123', mode: '1' });

Parameter:

  • data: string | number | object | array
  • ignore?: string[]
  • key: string
  • mode: string

doDecrypt

Dekripsi data string/object dengan algoritma custom.

const decrypted = doDecrypt({ data: encrypted, key: 'key123', mode: '1' });

Parameter:

  • data: string | number | object | array
  • ignore?: string[]
  • key: string
  • mode: string

generateRandomUUID

Membuat string unik mirip UUID.

generateRandomUUID(); // "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

Parameter:

  • panjang: number (default 36)