UNPKG

1.76 kBTypeScriptView Raw
1import { Arbitrary } from '../check/arbitrary/definition/Arbitrary';
2/**
3 * Constraints to be applied on {@link shuffledSubarray}
4 * @remarks Since 2.18.0
5 * @public
6 */
7export interface ShuffledSubarrayConstraints {
8 /**
9 * Lower bound of the generated subarray size (included)
10 * @defaultValue 0
11 * @remarks Since 2.4.0
12 */
13 minLength?: number;
14 /**
15 * Upper bound of the generated subarray size (included)
16 * @defaultValue The length of the original array itself
17 * @remarks Since 2.4.0
18 */
19 maxLength?: number;
20}
21/**
22 * For subarrays of `originalArray`
23 *
24 * @param originalArray - Original array
25 *
26 * @remarks Since 1.5.0
27 * @public
28 */
29declare function shuffledSubarray<T>(originalArray: T[]): Arbitrary<T[]>;
30/**
31 * For subarrays of `originalArray`
32 *
33 * @param originalArray - Original array
34 * @param minLength - Lower bound of the generated array size
35 * @param maxLength - Upper bound of the generated array size
36 *
37 * @deprecated
38 * Superceded by `fc.shuffledSubarray(originalArray, {minLength, maxLength})` - see {@link https://github.com/dubzzz/fast-check/issues/992 | #992}.
39 * Ease the migration with {@link https://github.com/dubzzz/fast-check/tree/main/codemods/unify-signatures | our codemod script}.
40 *
41 * @remarks Since 1.5.0
42 * @public
43 */
44declare function shuffledSubarray<T>(originalArray: T[], minLength: number, maxLength: number): Arbitrary<T[]>;
45/**
46 * For subarrays of `originalArray`
47 *
48 * @param originalArray - Original array
49 * @param constraints - Constraints to apply when building instances
50 *
51 * @remarks Since 2.4.0
52 * @public
53 */
54declare function shuffledSubarray<T>(originalArray: T[], constraints: ShuffledSubarrayConstraints): Arbitrary<T[]>;
55export { shuffledSubarray };