Phone number parser, validator, formatter, and generator for Indonesia (Indonesian phone numbers). Version 1.0.1, zero dependencies, TypeScript-first with 100% test coverage, dual ESM+CJS, tree-shakeable. Unlike other libraries, it includes a built-in operator database (42 prefixes from 3 MNOs + 1 satellite operator) and uses Indonesian error messages. Supports E.164, international, domestic, and compact formats, and can generate valid phone numbers for testing.
npm install phone-idNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates validation, parsing, formatting, and generation of Indonesian phone numbers using all main API functions.
Do not use generated numbers in production without validation.
Upgrade Node.js to version 20 or higher.
Expect error strings in Bahasa Indonesia; handle them accordingly in your application.
N/A
Use import statements or set "type": "module" in package.json. Alternatively, use dynamic import()
Use named imports: import { validatePhone } from 'phone-id'Always check result.valid before accessing other properties, or use validation beforehand.
No dependency data recorded yet.