Skip to content

array

array<T, Min>(arbitrary, constraints): Dependent<ArrayOf<T, Min>>

It generates an array of arbitrary values, with a length between minLength and maxLength, and with unique items if uniqueItems is true.

Example

random(array(integer()))
// => [1, 3, 4]

Type Parameters

T

Min extends number = number

Parameters

arbitrary

Arbitrary<T>

The arbitraries to create an array of.

constraints

MaybePartial<ArrayGenerator<T, Min>> = {}

MaybePartial<ArrayGenerator>

Returns

Dependent<ArrayOf<T, Min>>

An arbitrary that generates a record of all the properties of the given arbitraries.