Forger Help

SpoofSettings Overview

SpoofSettings is the single optional argument of Forger.create and Forger.createWith. It tunes how numbers, strings, dates, and arrays are generated. Anything omitted falls back to the default.

Usage

const user = Forger.create<User>({ numberMax: 100, // numbers stay small stringLength: 8, // shorter strings arrayLength: 5, // bigger arrays dateMin: new Date(2024, 0, 1), });

Settings are merged with the defaults per call, so a settings object with a single key is perfectly fine — the rest keeps default behavior. The object may be inline, a variable, or the result of a function call.

Full reference

Option

Type

Default

Affects

Details

numberMin

number

1

Lower bound of numbers, inclusive

Numbers

numberMax

number

1000

Upper bound of numbers, inclusive

Numbers

numberFloat

boolean

false

Fractional instead of integer numbers

Numbers

stringLength

number

10

Length of generated strings

Strings

stringNumbers

boolean

true

Digits in the string charset

Strings

stringLowCase

boolean

true

Lowercase letters in the charset

Strings

stringUpCase

boolean

true

Uppercase letters in the charset

Strings

stringSpecial

boolean

true

Special characters in the charset

Strings

dateMin

Date or string

2000-01-01

Lower bound of dates, inclusive

Dates

dateMax

Date or string

4000-01-01

Upper bound of dates, inclusive

Dates

arrayLength

number

3

Length of generated arrays

Arrays

Scope

Settings apply per call and flow into every nested level — a numberMax: 10 limits all numbers in the whole object graph, and arrayLength sizes arrays at every depth.

interface Metric { value: number; history: number[] } const metric = Forger.create<Metric>({ numberMax: 10, arrayLength: 5 })!; // { value: ≤ 10, history: 5 numbers, each ≤ 10 }

Booleans, enums, literal unions, tuples, and circular depth are not affected by settings — their behavior is defined by the type itself.

Type definition

The class behind the settings with all defaults spelled out is documented in API Reference: SpoofSettings.

08 September 2026