Measures the time it takes for a promise to resolve or reject.
import { duration } from "@mrspartak/promises"import { migrate } from "./migrate"const migratePromise = migrate()// Measure the duration of the migrate functionconst [error, result, duration] = await duration(migratePromise)console.log(`Migration took ${duration}ms`) Copy
import { duration } from "@mrspartak/promises"import { migrate } from "./migrate"const migratePromise = migrate()// Measure the duration of the migrate functionconst [error, result, duration] = await duration(migratePromise)console.log(`Migration took ${duration}ms`)
The promise to be measured.
A promise that resolves to a tuple containing either an error or a value, and the duration in milliseconds.
Measures the time it takes for a promise to resolve or reject.
Example