UNPKG

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