indofaker
v0.1.0
Published
Generate realistic Indonesian dummy data.
Readme
indofaker
Generate realistic Indonesian dummy data: names, addresses, phone numbers, and emails — with authentic Indonesian characteristics such as ethnicity-based naming, village & district addressing, and local mobile number prefixes.
Works in JavaScript, TypeScript, Node.js, and Bun.
Installation
npm
npm install indofakerpnpm
pnpm install indofakerbun
bun add indofakerImport and Usage
import {
getRandomName,
getRandomAddress,
getRandomPhone,
getRandomEmail
} from "indofaker";
console.log(getRandomName());
console.log(getRandomAddress());
console.log(getRandomPhone());
console.log(getRandomEmail());Name Generator
getRandomName(options?: {
gender?: "male" | "female";
ethnicity?: "common" | "jawa" | "sunda" | "batak" | "minang" | "bugis" | "bali" | "papua" | "tionghoa" | "arab" | "random";
});Ethnicity Options
| Key | Description | |-----------|-------------| | common | Neutral Indonesian names | | jawa | Javanese | | sunda | Sundanese | | batak | Batak (auto surname/marga) | | minang | Minangkabau | | bugis | Bugis | | bali | Balinese | | papua | Papuan | | tionghoa | Indonesian Chinese naming + surnames | | arab | Arab-Indonesian naming |
Examples
getRandomName();
// "Dimas Handoko Santoso"
getRandomName({ gender: "female" });
// "Rahayu Sri"
getRandomName({ ethnicity: "batak" });
// "Togar Simanjuntak"
getRandomName({ ethnicity: "tionghoa", gender: "female" });
// "Celine Tan"Address Generator
getRandomAddress(options?: {
lang?: "id" | "en"; // default: "id"
});Format (id)
Jl. Mawar No. 24, RT 03/RW 05, Kel. Sukamaju, Kec. Bojongloa, Kota Bandung, Jawa Barat, 40231Format (en)
24 Mawar St, Sukamaju Village, Bojongloa District, Bandung City, West Java, 40231Phone Number Generator
getRandomPhone(options?: {
provider?: "all" | "telkomsel" | "indosat" | "xl" | "tri" | "smartfren";
format?: "local" | "intl"; // default: local
});Examples:
getRandomPhone();
// "085712345678"
getRandomPhone({ provider: "xl" });
// "087812345678"getRandomPhone({ format: "intl" });
// "+6285712345678"Email Generator
getRandomEmail(options?: {
domain?: string; // default: "gmail.com"
});Rules:
- Takes result from
getRandomName() - Converts to lowercase
- Randomly uses underscore or no separator
- Random chance to append 1–4 digit number
Example:
getRandomEmail();
// "[email protected]"
getRandomEmail({ domain: "company.org" });
// "[email protected]"License
MIT
Support Us
If you find this project useful and would like to support its development, you can do so here:
- Saweria: https://saweria.co/elbuho1315
- Ko-fi : https://ko-fi.com/elbuho1315
Thank you for your support.
