* move `cli` to its own package `@tailwindcss/cli` * minify builds when using `tsup` * prefer tsup cli flag over tsup.config.ts file * add `--clean`, to make sure `dist/` folders are cleaned before building * make CLI esm only * use version of `tailwindcss` instead of the version of `@tailwindcss/cli`
23 lines
434 B
TypeScript
23 lines
434 B
TypeScript
export function formatNanoseconds(input: bigint | number) {
|
|
let ns = typeof input === 'number' ? BigInt(input) : input
|
|
|
|
if (ns < 1_000n) return `${ns}ns`
|
|
ns /= 1_000n
|
|
|
|
if (ns < 1_000n) return `${ns}µs`
|
|
ns /= 1_000n
|
|
|
|
if (ns < 1_000n) return `${ns}ms`
|
|
ns /= 1_000n
|
|
|
|
if (ns < 60n) return `${ns}s`
|
|
ns /= 60n
|
|
|
|
if (ns < 60n) return `${ns}m`
|
|
ns /= 60n
|
|
|
|
if (ns < 24n) return `${ns}h`
|
|
ns /= 24n
|
|
|
|
return `${ns}d`
|
|
}
|