Test data (fake)
- 3174081502956104
- 5321124709513217
- 3603145212584822
- 7102226209055152
- 3471126703912239
The same seed gives the same values in Go and TypeScript. For tests only.
Runs in your browser.
Every generator takes a 32-bit seed (uint32 in Go, an integer from 0 to 4,294,967,295 in TypeScript). The same seed and options return the same value in Go and TypeScript, so fixtures can be shared between a Go backend and a TypeScript frontend.
Functions
Section titled “Functions”| Go | TypeScript | Options |
|---|---|---|
fake.NIK(seed, opts) |
await fake.nik(seed, opts?) |
region, birthDate, sex |
fake.NPWP(seed) |
fake.npwp(seed) |
|
fake.Phone(seed) |
fake.phone(seed) |
|
fake.NIP(seed, opts) |
fake.nip(seed, opts?) |
birthDate, sex |
fake.NISN(seed) |
fake.nisn(seed) |
|
fake.Plate(seed, opts) |
fake.plate(seed, opts?) |
region (plate code such as B) |
- A NIK uses a real district code.
regioncan pin it to a province (31), regency (31.71) or district (31.71.01).birthDate(YYYY-MM-DD) andsex(maleorfemale) set the encoded date and the +40 day offset. - In TypeScript
fakeis only exported fromnusaindex/fake, never from the root, so it cannot end up in a production bundle by accident.fake.nikis async because district data loads per province. - Go returns
stringfor generators without options. TypeScript returns aResultfor all of them, which fails withoptionsfor an invalid seed.
Changes to region data can change the NIK generated for a seed. Pin the NusaIndex version in tests that compare exact values.
Errors
Section titled “Errors”options, date, region.
Example
Section titled “Example”package main
import ( "fmt"
"github.com/haikalmumtaz233/nusaindex/fake")
func main() { id, err := fake.NIK(7, fake.NIKOptions{Region: "31.71", BirthDate: "1990-05-17", Sex: fake.SexFemale}) if err == nil { fmt.Println(id) }
fmt.Println(fake.NPWP(3)) fmt.Println(fake.Phone(11)) fmt.Println(fake.NISN(7))
employee, err := fake.NIP(5, fake.NIPOptions{BirthDate: "1990-05-17", Sex: fake.SexFemale}) if err == nil { fmt.Println(employee) }
car, err := fake.Plate(7, fake.PlateOptions{Region: "B"}) if err == nil { fmt.Println(car) }}import * as fake from "nusaindex/fake";
const id = await fake.nik(7, { region: "31.71", birthDate: "1990-05-17", sex: "female" });if (id.ok) { console.log(id.value);}
for (const generated of [fake.npwp(3), fake.phone(11), fake.nisn(7)]) { if (generated.ok) { console.log(generated.value); }}
const employee = fake.nip(5, { birthDate: "1990-05-17", sex: "female" });if (employee.ok) { console.log(employee.value);}
const car = fake.plate(7, { region: "B" });if (car.ok) { console.log(car.value);}31710357059008120315588931648000+62832356444886299763315199005172021112541B 3739 J© 2026 Haikal Mumtaz