import { Arbitrary } from './definition/Arbitrary'; /** * Constraints for {@link anything} and {@link object} * @public */ export interface ObjectConstraints { /** Maximal depth allowed */ maxDepth?: number; /** Maximal number of keys */ maxKeys?: number; /** * Arbitrary for keys * * Default for `key` is: {@link string} */ key?: Arbitrary; /** * Arbitrary for values * * Default for `values` are: * - {@link boolean}, * - {@link integer}, * - {@link double}, * - {@link string} * - constants among: * - `null`, * - `undefined`, * - `Number.NaN`, * - `+0`, * - `-0`, * - `Number.EPSILON`, * - `Number.MIN_VALUE`, * - `Number.MAX_VALUE`, * - `Number.MIN_SAFE_INTEGER`, * - `Number.MAX_SAFE_INTEGER`, * - `Number.POSITIVE_INFINITY`, * - `Number.NEGATIVE_INFINITY` */ values?: Arbitrary[]; /** Also generate boxed versions of values */ withBoxedValues?: boolean; /** Also generate Set */ withSet?: boolean; /** Also generate Map */ withMap?: boolean; /** Also generate string representations of object instances */ withObjectString?: boolean; /** Also generate object with null prototype */ withNullPrototype?: boolean; /** Also generate BigInt */ withBigInt?: boolean; } /** * For any type of values * * You may use {@link sample} to preview the values that will be generated * * @example * ```javascript * null, undefined, 42, 6.5, 'Hello', {}, {k: [{}, 1, 2]} * ``` * * @public */ declare function anything(): Arbitrary; /** * For any type of values following the constraints defined by `settings` * * You may use {@link sample} to preview the values that will be generated * * @example * ```javascript * null, undefined, 42, 6.5, 'Hello', {}, {k: [{}, 1, 2]} * ``` * * @example * ```typescript * // Using custom settings * fc.anything({ * key: fc.char(), * 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]... * ``` * * @param constraints - Constraints to apply when building instances * * @public */ declare function anything(constraints: ObjectConstraints): Arbitrary; /** * For any objects * * You may use {@link sample} to preview the values that will be generated * * @example * ```javascript * {}, {k: [{}, 1, 2]} * ``` * * @public */ declare function object(): Arbitrary>; /** * For any objects following the constraints defined by `settings` * * You may use {@link sample} to preview the values that will be generated * * @example * ```javascript * {}, {k: [{}, 1, 2]} * ``` * * @param constraints - Constraints to apply when building instances * * @public */ declare function object(constraints: ObjectConstraints): Arbitrary>; /** * For any JSON compliant values * * Keys and string values rely on {@link string} * * @public */ declare function jsonObject(): Arbitrary; /** * For any JSON compliant values with a maximal depth * * Keys and string values rely on {@link string} * * @param maxDepth - Maximal depth of the generated values * * @public */ declare function jsonObject(maxDepth: number): Arbitrary; /** * For any JSON compliant values with unicode support * * Keys and string values rely on {@link unicode} * * @public */ declare function unicodeJsonObject(): Arbitrary; /** * For any JSON compliant values with unicode support and a maximal depth * * Keys and string values rely on {@link unicode} * * @param maxDepth - Maximal depth of the generated values * * @public */ declare function unicodeJsonObject(maxDepth: number): Arbitrary; /** * For any JSON strings * * Keys and string values rely on {@link string} * * @public */ declare function json(): Arbitrary; /** * For any JSON strings with a maximal depth * * Keys and string values rely on {@link string} * * @param maxDepth - Maximal depth of the generated objects * * @public */ declare function json(maxDepth: number): Arbitrary; /** * For any JSON strings with unicode support * * Keys and string values rely on {@link unicode} * * @public */ declare function unicodeJson(): Arbitrary; /** * For any JSON strings with unicode support and a maximal depth * * Keys and string values rely on {@link unicode} * * @param maxDepth - Maximal depth of the generated objects * * @public */ declare function unicodeJson(maxDepth: number): Arbitrary; export { anything, object, jsonObject, unicodeJsonObject, json, unicodeJson };