Skip to main content

API Reference

createMimic(locale?: string): Mimic

Creates a new Mimic instance for the given locale. Defaults to 'en_US'.

const mimic = createMimic('en_US');

Parameters

ParamTypeDefaultDescription
localestring'en_US'Locale code (e.g., id_ID, ja_JP, de_DE)

Returns

A Mimic instance with the following modules:

ModuleDescription
identityName, gender, age, date of birth generators
locationStreet, city, state, zip code, address generators
physicalHeight, weight generators (locale-aware units)
workJob title, department generators
contactEmail, phone, website generators
companyCompany name, industry, catchphrase generators

Mimic.setLocale(locale: string): void

Switches the instance's locale at runtime. Clears all cached generators.

Mimic.generateMockEntities(count: number, options?): object[]

Generates an array of combined mock entities (person + address + physical + work + contact + company).

Options

OptionTypeDescription
gender'male' | 'female'Filter by gender
ageRange{ min: number, max: number }Age range filter

Mimic.generateUniqueMockEntities(count: number, options?): object[]

Same as generateMockEntities, but deduplicates by full name.

Random.seed(value: number): void

Seeds the global PRNG with a specific value for deterministic output.

Random.unseed(): void

Reverts the PRNG to use Math.random().