Fake
Generate realistic fake data — names, emails, addresses, companies, text and more — with gofakeit. The fake data kinds page lists every kind fake() accepts.
Random values follow the run’s seed, so a run can be repeated; see random values and seeds.
fake
fake(kind, params...) → anyGenerate fake data of the given kind: a name, email, address, company, sentence, and 350 more.
Kinds come from gofakeit; the fake data kinds page lists them with their parameters. Pass parameters as an object; a list sets a parameter that takes several values. Kinds that produce a number, bool or string return that type; the rest (person, address, creditcard, …) return an object. An unknown kind or parameter fails at plan time.
| Parameter | Type | Description |
|---|---|---|
kind | string | What to generate, e.g. "email". |
params... | object | The kind’s parameters. Optional. |
fake("name")→ "Giovanni Bartell"
fake("number", { min = 18, max = 90 })→ 42
fake("loremipsumsentence", { wordcount = 6 })→ "Illum ab temporibus exercitationem et ut."
fake("address").city→ "Philadelphia"
faketemplate
faketemplate(pattern) → stringFill a pattern with fake data: {kind} placeholders, # for a digit, ? for a letter.
A placeholder can pass parameters after a colon, in order: {number:1,100}.
| Parameter | Type | Description |
|---|---|---|
pattern | string |
faketemplate("{firstname}.{lastname}@example.com")→ "Fabian.Weber@example.com"
faketemplate("INV-####-??")→ "INV-4821-qk"