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

    Function dependent

    • Creates a schema that generates a value only if a condition based on the parent object is met. If the condition is not met, it generates undefined. Primarily used within f.object.

      Type Parameters

      • ParentType = unknown

        The expected type of the parent object being built (used in the condition function). Defaults to unknown.

      • S extends Schema<any> = Schema<unknown>

        The schema type for the dependent value.

      Parameters

      • schema: S

        The schema to use for generating the value if the condition is met.

      • options: DependentOptions<ParentType>

        The options containing the condition function.

      Returns Schema<undefined | Infer<S>>

      A schema that generates Infer<S> or undefined.