Our own MaybePromise

This commit is contained in:
Valentin Brandl 2024-08-28 16:13:11 +02:00
parent c9990e9d30
commit 29e06fdf91

View File

@ -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 }> {