@eleven-am/faker
    Preparing search index...

    Class SchemaImpl<T>

    Type Parameters

    • T

    Implements

    Index

    Constructors

    Properties

    constraints: { predicate: (val: T) => boolean; retries: number }[] = []
    currentOptions: Record<string, any> = {}
    generatorFn: (context: GeneratorContext) => T

    Methods

    • Parameters

      • c: "lower" | "upper" | "capitalize" | "title"

      Returns this

    • Parameters

      • c: string

      Returns this

    • Internal helper to create a new instance with updated options

      Parameters

      • newOptions: Partial<Record<string, any>>

      Returns this

    • Parameters

      • d: "uniform" | "normal" | "exponential" | "recent"
      • Optionalopts: any

      Returns this

    • Parameters

      • e: string | RegExp | (string | RegExp)[]

      Returns this

    • Generates a single value using the schema.

      Parameters

      • contextOptions: Partial<Omit<GeneratorContext, "rng" | "options">> & { seed?: number } = {}

      Returns T

    • Generates an array of values using the schema.

      Parameters

      • count: number
      • options: { seed?: number } = {}

      Returns T[]

    • Parameters

      • l: number

      Returns this

    • Parameters

      • p: number

      Returns this

    • Parameters

      • v: string | number | Date

      Returns this

    • Parameters

      • l: number

      Returns this

    • Parameters

      • v: string | number | Date

      Returns this

    • Parameters

      • l: number

      Returns this

    • Parameters

      • e: boolean = true

      Returns this

    • Parameters

      • e: boolean = true

      Returns this

    • Makes the generated value potentially null.

      Parameters

      • probability: number = 0.5

      Returns Schema<null | T>

    • Parameters

      • p: RegExp

      Returns this

    • Parameters

      • d: number

      Returns this

    • Parameters

      • p: string

      Returns this

    • Parameters

      • Optionals: boolean | ((a: any, b: any) => number)

      Returns this

    • Parameters

      • s: string

      Returns this

    • Parameters

      • u: boolean = true

      Returns this

    • Adds a constraint that the generated value must satisfy. Retries generation up to retries times if the predicate fails.

      Parameters

      • predicate: (val: T) => boolean
      • retries: number = 10

      Returns Schema<T>