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

@indodev/toolkit

v0.2.0

Published

Indonesian developer utilities for validation, formatting, and more

Readme

@indodev/toolkit

TypeScript utilities for Indonesian data validation and formatting.

CI npm version bundle size TypeScript License: MIT

Why?

Building apps for Indonesia means dealing with NIK validation, phone number formatting, Rupiah display, and proper text handling. Instead of rewriting the same logic across projects, use battle-tested utilities that just work.

Features

  • NIK validation - Verify Indonesian National Identity Numbers with province, date, and gender checks
  • Phone formatting - Support for all major operators (Telkomsel, XL, Indosat, Smartfren, Axis) and 200+ area codes
  • Rupiah formatting - Display currency with proper grammar rules (1,5 juta, not 1,0 juta)
  • Text utilities - Smart capitalization, slug generation, abbreviation expansion, and string comparison with Indonesian language support
  • Terbilang converter - Numbers to Indonesian words (1500000 → "satu juta lima ratus ribu rupiah")
  • Type-safe - Full TypeScript support with proper type inference
  • Well-tested - 1060+ test cases with 95%+ coverage
  • Zero dependencies - Lightweight and tree-shakeable

Install

npm install @indodev/toolkit

Quick Start

NIK Validation & Parsing

import { validateNIK, parseNIK, maskNIK } from '@indodev/toolkit/nik';

// Validate
validateNIK('3201234567890123'); // true

// Extract info
const info = parseNIK('3201234567890123');
console.log(info.province.name); // 'Jawa Barat'
console.log(info.gender); // 'male' or 'female'

// Mask for privacy
maskNIK('3201234567890123'); // '3201****0123'

Phone Numbers

import {
  validatePhoneNumber,
  formatPhoneNumber,
  getOperator,
} from '@indodev/toolkit/phone';

// Validate and format
validatePhoneNumber('081234567890'); // true
formatPhoneNumber('081234567890', 'international'); // '+62 812-3456-7890'

// Detect operator
getOperator('081234567890'); // 'Telkomsel'

Currency Formatting

import {
  formatRupiah,
  formatCompact,
  toWords,
} from '@indodev/toolkit/currency';

// Standard format
formatRupiah(1500000); // 'Rp 1.500.000'

// Compact format (follows Indonesian grammar!)
formatCompact(1500000); // 'Rp 1,5 juta'
formatCompact(1000000); // 'Rp 1 juta' (not '1,0 juta')

// Terbilang
toWords(1500000); // 'satu juta lima ratus ribu rupiah'

Text Utilities

import {
  toTitleCase,
  slugify,
  expandAbbreviation,
  truncate,
} from '@indodev/toolkit/text';

// Smart title case (respects Indonesian particles)
toTitleCase('buku panduan belajar di rumah');
// 'Buku Panduan Belajar di Rumah'

// Indonesian-aware slugs
slugify('Pria & Wanita'); // 'pria-dan-wanita'
slugify('Hitam/Putih'); // 'hitam-atau-putih'

// Expand abbreviations
expandAbbreviation('Jl. Sudirman No. 45');
// 'Jalan Sudirman Nomor 45'

// Smart truncation
truncate('Ini adalah text yang sangat panjang', 20);
// 'Ini adalah text...'

API Reference

NIK Module

| Function | Description | | ---------------------------- | ------------------------------------ | | validateNIK(nik) | Check if NIK is valid | | parseNIK(nik) | Extract province, birth date, gender | | formatNIK(nik, separator?) | Format with separators | | maskNIK(nik, options?) | Mask for privacy |

Phone Module

| Function | Description | | ---------------------------------- | ------------------------------------- | | validatePhoneNumber(phone) | Validate Indonesian phone numbers | | formatPhoneNumber(phone, format) | Format to international/national/e164 | | getOperator(phone) | Detect operator (Telkomsel, XL, etc) | | parsePhoneNumber(phone) | Get all phone info |

Currency Module

| Function | Description | | -------------------------------- | -------------------------------- | | formatRupiah(amount, options?) | Standard Rupiah format | | formatCompact(amount) | Compact format (1,5 juta) | | parseRupiah(formatted) | Parse formatted string to number | | toWords(amount, options?) | Convert to Indonesian words |

Text Module

| Function | Description | | -------------------------------------- | ----------------------------------------------- | | toTitleCase(text, options?) | Smart capitalization with Indonesian rules | | slugify(text, options?) | URL-friendly slugs with Indonesian conjunctions | | expandAbbreviation(text, options?) | Expand Indonesian abbreviations (Jl., Bpk.) | | truncate(text, maxLength, options?) | Smart text truncation at word boundaries | | compareStrings(str1, str2, options?) | Robust string comparison | | sanitize(text, options?) | Clean and normalize text |

TypeScript Support

Full type inference out of the box:

import type { NIKInfo, PhoneInfo, RupiahOptions } from '@indodev/toolkit';

const nikInfo: NIKInfo = parseNIK('3201234567890123');
// Auto-complete for province, birthDate, gender ✓

Tree-Shaking

Import only what you need - unused code gets removed:

// ✅ Recommended: Import from submodules
import { formatRupiah } from '@indodev/toolkit/currency';
import { validateNIK } from '@indodev/toolkit/nik';
import { slugify } from '@indodev/toolkit/text';

// ⚠️ Works but imports everything
import { formatRupiah, validateNIK, slugify } from '@indodev/toolkit';

Bundle Size

| Module | Size (minified + gzipped) | | --------- | ------------------------- | | NIK | ~5 KB | | Phone | ~12 KB | | Currency | ~6 KB | | Text | ~8 KB | | Total | ~31 KB |

Requirements

  • Node.js >= 18
  • TypeScript >= 5.0 (optional)

Documentation

License

MIT © choiruladamm


Made with ❤️ for Indonesian developers. Stop copy-pasting, start shipping.