@amadeus-it-group/kassette
Version:
Development server, used mainly for testing, which proxies requests and is able to easily manage local mocks.
20 lines (19 loc) • 699 B
TypeScript
/**
* A single value or a virtually unlimitedly nested array of this type of value
*
* @public
*/
export type RecursiveArray<T> = T | Array<RecursiveArray<T>>;
export declare const flatten: <T>(input: RecursiveArray<T>) => T[];
/**
* A virtually unlimitedly nested array of values, including void and non-void ones
*/
export type NonSanitizedArray<T = any> = RecursiveArray<T | null | undefined>;
/**
* A non-nested array of non void values
*/
export type SanitizedArray<T = any> = Array<Exclude<T, null | undefined | Array<any>>>;
/**
* Turns the `NonSanitizedArray` `array` into a `SanitizedArray`
*/
export declare const sanitize: <T>(array: NonSanitizedArray<T>) => SanitizedArray<T>;