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

    Function reference

    • Creates a schema that randomly picks an item from a provided collection. Optionally returns the value of a specific field (idField) from the chosen item.

      Type Parameters

      • RefT extends object

        The type of objects within the collection (must extend object).

      Parameters

      • options: ReferenceOptions<RefT>

        Configuration including the collection and optional idField.

      Returns Schema<
          | ReferenceReturnType<RefT, undefined>
          | ReferenceReturnType<RefT, keyof RefT>,
      >

      A schema generating either a value from the idField or the entire selected object.