Skip to Content
DocumentationHome

@indodev/toolkit

Type-safe utilities for Indonesian data validation and formatting. Github 

Features

  • 🎯 Type-Safe - Full TypeScript support with strict types
  • 📦 Tree-Shakeable - Import only what you need (~10KB per module)
  • âš¡ Zero Dependencies - No external dependencies. Fast and secure
  • 🧪 Battle-Tested - 95%+ test coverage with 470+ test cases

Installation

npm install @indodev/toolkit

Quick Example

import { validateNIK } from '@indodev/toolkit/nik' import { formatPhoneNumber } from '@indodev/toolkit/phone' import { formatRupiah } from '@indodev/toolkit/currency' // Validate NIK validateNIK('3201234567890123') // true // Format phone number formatPhoneNumber('081234567890', 'international') // '+62 812-3456-7890' // Format currency formatRupiah(1500000) // 'Rp 1.500.000'

Modules

NIK

Validate, parse, format, and mask Indonesian National Identity Numbers. Extract location, birth date, and gender information.

Phone

Validate and format Indonesian phone numbers. Detect operators (Telkomsel, XL, Indosat, etc.) and handle 200+ area codes.

Currency

Format Indonesian Rupiah with proper separators. Convert numbers to words (terbilang) for invoices and legal documents.

Why @indodev/toolkit?

Building applications that handle Indonesian data? This library solves common challenges:

  • NIK Validation - Ensure national IDs are valid before processing
  • Phone Formatting - Display phone numbers consistently across your app
  • Rupiah Formatting - Show prices with proper Indonesian formatting
  • Operator Detection - Send SMS through the right gateway
  • Terbilang Conversion - Generate invoices and receipts with words
  • Privacy Protection - Mask sensitive data appropriately

What’s Next?

Last updated on