abolish
Version:
A javascript object validator.
19 lines (18 loc) • 573 B
TypeScript
/**
* Check if a variable is type of the given types.
* Throw an error if it is not.
* @param option
* @param type
* @param name
*/
export declare function assertType<T>(option: T, type: string | string[], name?: string): true | never;
/**
* Check if a variable is type of the given types.
* @param option
* @param type
*/
export declare function isType<T>(option: T, type: string | string[]): boolean;
/**
* Function that checks if an array values is of the given types.
*/
export declare function arrayIsTypeOf(arr: any[], types: string | string[]): boolean;