meows
Version:
A kittybin of tools.
31 lines (30 loc) • 1.04 kB
TypeScript
import { cond } from './functions';
export declare const log: (...a: any[]) => void;
export declare const logStr: (msg: string, ...a: any[]) => void;
/**
* Log something to console with optional message, then returns identical input.
*
* @example
* Promise.all(pending)
* .then(x => logId(x, 'task: done'))
* .then(sendTask)
*/
export declare const logId: (x: any, msg?: string) => any;
/**
* Creates a string for an error message for your function.
* @param fnName name of your function
* @param reqs list of type requirements
* @param args arguments received by function
*
* @example
* throw new Error(ErrorMsg(isEven, ['integer'], arguments))
*/
export declare function ErrorMsg(fnName: string, reqs: string[], args: any[]): string;
/**
* Takes an array of boolean functions, an argument to run with the tests, and
* and an optional error message.
*
* @example
* ifOrThrow(100, [isType.int, isEven], `Value wasn't an even integer.`)
*/
export declare function ifOrThrow(ifs: cond[], arg: any, msg?: string): void;