UNPKG

1.2 kBTypeScriptView Raw
1import { Arbitrary } from '../check/arbitrary/definition/Arbitrary';
2/**
3 * Constraints to be applied on {@link mixedCase}
4 * @remarks Since 1.17.0
5 * @public
6 */
7export interface MixedCaseConstraints {
8 /**
9 * Transform a character to its upper and/or lower case version
10 * @remarks Since 1.17.0
11 */
12 toggleCase?: (rawChar: string) => string;
13 /**
14 * In order to be fully reversable (only in case you want to shrink user definable values)
15 * you should provide a function taking a string containing possibly toggled items and returning its
16 * untoggled version.
17 */
18 untoggleAll?: (toggledString: string) => string;
19}
20/**
21 * Randomly switch the case of characters generated by `stringArb` (upper/lower)
22 *
23 * WARNING:
24 * Require bigint support.
25 * Under-the-hood the arbitrary relies on bigint to compute the flags that should be toggled or not.
26 *
27 * @param stringArb - Arbitrary able to build string values
28 * @param constraints - Constraints to be applied when computing upper/lower case version
29 *
30 * @remarks Since 1.17.0
31 * @public
32 */
33export declare function mixedCase(stringArb: Arbitrary<string>, constraints?: MixedCaseConstraints): Arbitrary<string>;