Our own MaybePromise
This commit is contained in:
parent
c9990e9d30
commit
29e06fdf91
@ -1,7 +1,6 @@
|
||||
// place files you want to import through the `$lib` alias in this folder.
|
||||
import path from 'path';
|
||||
import bunyan from 'bunyan';
|
||||
import type { MaybePromise } from '@sveltejs/kit';
|
||||
|
||||
export const log = bunyan.createLogger({
|
||||
name: 'fotochallenge',
|
||||
@ -33,6 +32,8 @@ export const requestIdHeader = 'x-request-id';
|
||||
|
||||
export default safePath;
|
||||
|
||||
export type MaybePromise<T> = T | Promise<T>;
|
||||
|
||||
export async function timedExecution<T>(
|
||||
fn: () => MaybePromise<T>
|
||||
): Promise<{ executionTime: number; result: T }> {
|
||||
|
Reference in New Issue
Block a user