toofast
Version:
The Node.js performance testing tool with unit-test-like API.
17 lines (16 loc) • 426 B
JavaScript
export function noop() { }
export function getErrorMessage(error) {
return error instanceof Error ? error.stack || error.message : String(error);
}
export function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
export function combineHooks(a, b) {
if (a === undefined || b === undefined) {
return a || b;
}
return async () => {
await a();
await b();
};
}