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 🙏

© 2026 – Pkg Stats / Ryan Hefner

agani-id-formatter

v1.0.1

Published

Indonesian formatting utilities for common data types (Rupiah, Phone, NIK, NPWP, Dates, etc.)

Readme

🇮🇩 Agani ID Formatter

Package JavaScript ringan untuk memformat dan validasi data khas Indonesia seperti Rupiah, Nomor Telepon, NIK, NPWP, dan lainnya.

npm version License: MIT

📦 Instalasi

npm install agani-id-formatter

atau dengan yarn:

yarn add agani-id-formatter

🚀 Penggunaan

Import Package

const { formatRupiah, formatPhone, validateNIK, validateNPWP, formatNPWP, formatDate, formatNIK, parseRupiah, validatePostalCode, formatBankAccount } = require('agani-id-formatter');

Format Rupiah

formatRupiah(15000); // "Rp 15.000"

formatRupiah(1500000); // "Rp 1.500.000"

formatRupiah(15000, false); // "15.000" (tanpa prefix Rp)

formatRupiah(-50000); // "-Rp 50.000"

Parse Rupiah

parseRupiah("Rp 15.000"); // 15000

parseRupiah("Rp 1.500.000"); // 1500000

Format Nomor Telepon

formatPhone("08123456789"); // "+628123456789"

formatPhone("8123456789"); // "+628123456789"

formatPhone("628123456789"); // "+628123456789"

formatPhone("08123456789", false); // "628123456789" (tanpa +)

Validasi NIK

validateNIK("3201012801990001"); // true

validateNIK("1234567890123456"); // false

validateNIK("320101"); // false (kurang dari 16 digit)

Format NIK

formatNIK("3201012801990001"); // "3201 0128 0199 0001"

Validasi NPWP

validateNPWP("012345678901000"); // true

validateNPWP("01.234.567.8-901.000"); // true (akan dibersihkan otomatis)

validateNPWP("12345"); // false

Format NPWP

formatNPWP("012345678901000"); // "01.234.567.8-901.000"

Format Tanggal Indonesia

formatDate(new Date("2024-01-15")); // "15 Januari 2024"

formatDate(new Date("2024-01-15"), true); // "Senin, 15 Januari 2024"

formatDate("2024-12-25"); // "25 Desember 2024"

Validasi Kode Pos

validatePostalCode("12345"); // true

validatePostalCode("1234"); // false

validatePostalCode("ABCDE"); // false

Format Nomor Rekening

formatBankAccount("1234567890"); // "1234-5678-90"

formatBankAccount("123456"); // "1234-56"

📚 API Reference

formatRupiah(amount, withPrefix)

Format angka menjadi format Rupiah Indonesia.

  • amount {number|string} - Jumlah yang akan diformat
  • withPrefix {boolean} - Tampilkan prefix "Rp" (default: true)
  • Returns {string} - String Rupiah yang sudah diformat

parseRupiah(rupiah)

Parse string Rupiah menjadi angka.

  • rupiah {string} - String Rupiah yang akan di-parse
  • Returns {number} - Angka hasil parsing

formatPhone(phone, withPlus)

Format nomor telepon Indonesia ke format internasional.

  • phone {string} - Nomor telepon yang akan diformat
  • withPlus {boolean} - Tampilkan prefix "+" (default: true)
  • Returns {string} - Nomor telepon yang sudah diformat

validateNIK(nik)

Validasi NIK Indonesia (16 digit).

  • nik {string} - NIK yang akan divalidasi
  • Returns {boolean} - True jika valid

formatNIK(nik)

Format NIK dengan spasi untuk keterbacaan.

  • nik {string} - NIK yang akan diformat
  • Returns {string} - NIK yang sudah diformat

validateNPWP(npwp)

Validasi NPWP Indonesia (15 digit).

  • npwp {string} - NPWP yang akan divalidasi
  • Returns {boolean} - True jika valid

formatNPWP(npwp)

Format NPWP dengan format standar.

  • npwp {string} - NPWP yang akan diformat
  • Returns {string} - NPWP yang sudah diformat

formatDate(date, withDay)

Format tanggal ke format Indonesia.

  • date {Date|string} - Tanggal yang akan diformat
  • withDay {boolean} - Tampilkan nama hari (default: false)
  • Returns {string} - Tanggal yang sudah diformat

validatePostalCode(postalCode)

Validasi kode pos Indonesia (5 digit).

  • postalCode {string} - Kode pos yang akan divalidasi
  • Returns {boolean} - True jika valid

formatBankAccount(accountNumber)

Format nomor rekening bank dengan separator.

  • accountNumber {string} - Nomor rekening yang akan diformat
  • Returns {string} - Nomor rekening yang sudah diformat

🎯 Use Cases

Package ini sangat berguna untuk:

  • Aplikasi e-commerce Indonesia
  • Sistem pembayaran online
  • Form pendaftaran dan validasi data
  • Dashboard admin dan reporting
  • Aplikasi fintech
  • Sistem HRD dan payroll
  • Website pemerintahan
  • Dan banyak lagi!

🤝 Kontribusi

Kontribusi sangat diterima! Silakan buat issue atau pull request di repository GitHub.

  1. Fork repository
  2. Buat branch fitur (git checkout -b fitur-baru)
  3. Commit perubahan (git commit -am 'Tambah fitur baru')
  4. Push ke branch (git push origin fitur-baru)
  5. Buat Pull Request

📝 License

MIT License - lihat file LICENSE untuk detail lengkap.

🙏 Credits

Dibuat dengan ❤️ untuk komunitas developer Indonesia.

👨‍💻 Author

Abdul Gani Pohan

📞 Dukungan

Butuh bantuan? Berikut cara mendapatkan dukungan:

⭐ Star History

Jika project ini bermanfaat, kamu bisa memberikan ⭐ di GitHub untuk membantu pengembangan.

🎉 Dukung Project Ini

Jika kamu menyukai project ini:

  • ⭐ Beri bintang untuk repository di GitHub
  • 🐦 Bagikan di media sosial
  • 📝 Tulis blog atau review tentang penggunaannya
  • 💰 Buy me a coffee

Selamat menggunakan Agani ID Formatter! 🚀