@kikiutils/node
Version:
A modular utility library for Node.js offering secure hashing, flexible logging, datetime manipulation, and more.
21 lines • 1.15 kB
TypeScript
/**
* Generates a value using a provided generator function, where the input length
* is determined by two levels of nested random ranges:
*
* 1. First, a random number (`innerMin`) is chosen between `minMin` and `minMax`.
* 2. Then, a final length is chosen between `Math.max(innerMin, maxMin)` and `maxMax`.
* 3. The generator is called with the final length and its result is returned.
*
* This function supports any return type by using a generic type parameter.
*
* @typeParam T - The return type of the generator function.
*
* @param generator - A function that accepts a length and returns a value of type T.
* @param minMin - Lower bound of the first random range.
* @param minMax - Upper bound of the first random range.
* @param maxMin - Lower bound of the second random range.
* @param maxMax - Upper bound of the second random range.
* @returns The result of the generator function using the computed final length.
*/
export declare function generateWithNestedRandomLength<T = string>(generator: (length: number) => T, minMin: number, minMax: number, maxMin: number, maxMax: number): T;
//# sourceMappingURL=random.d.ts.map