Skip to content

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

impure
fake(kind, params...) → any

Generate 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.

ParameterTypeDescription
kindstringWhat to generate, e.g. "email".
params...objectThe 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

impure
faketemplate(pattern) → string

Fill 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}.

ParameterTypeDescription
patternstring
faketemplate("{firstname}.{lastname}@example.com")

→ "Fabian.Weber@example.com"

faketemplate("INV-####-??")

→ "INV-4821-qk"