Function: anything()
Call Signature
anything():
Arbitrary<unknown>
Defined in: packages/fast-check/src/arbitrary/anything.ts:21
For any type of values
You may use sample to preview the values that will be generated
Returns
Arbitrary<unknown>
Example
null, undefined, 42, 6.5, 'Hello', {}, {k: [{}, 1, 2]}
Remarks
Since 0.0.7
Call Signature
anything(
constraints):Arbitrary<unknown>
Defined in: packages/fast-check/src/arbitrary/anything.ts:52
For any type of values following the constraints defined by settings
You may use sample to preview the values that will be generated
Parameters
| Parameter | Type | Description |
|---|---|---|
constraints | ObjectConstraints | Constraints to apply when building instances |
Returns
Arbitrary<unknown>
Examples
null, undefined, 42, 6.5, 'Hello', {}, {k: [{}, 1, 2]}
// Using custom settings
fc.anything({
key: fc.string(),
values: [fc.integer(10,20), fc.constant(42)],
maxDepth: 2
});
// Can build entries such as:
// - 19
// - [{"2":12,"k":15,"A":42}]
// - {"4":[19,13,14,14,42,11,20,11],"6":42,"7":16,"L":10,"'":[20,11],"e":[42,20,42,14,13,17]}
// - [42,42,42]...
Remarks
Since 0.0.7