Home / Function/ formatNanoseconds() — tailwindcss Function Reference

formatNanoseconds() — tailwindcss Function Reference

Architecture documentation for the formatNanoseconds() function in format-ns.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  8f39fcf0_a336_611c_df3e_e1ab37efa73a["formatNanoseconds()"]
  668a6c78_97ae_1a3a_8906_d42fe854fff0["format-ns.ts"]
  8f39fcf0_a336_611c_df3e_e1ab37efa73a -->|defined in| 668a6c78_97ae_1a3a_8906_d42fe854fff0
  631984cc_17f1_69a1_5686_3f0b82fc1796["formatDuration()"]
  631984cc_17f1_69a1_5686_3f0b82fc1796 -->|calls| 8f39fcf0_a336_611c_df3e_e1ab37efa73a
  style 8f39fcf0_a336_611c_df3e_e1ab37efa73a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/@tailwindcss-cli/src/utils/format-ns.ts lines 1–23

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`
}

Subdomains

Called By

Frequently Asked Questions

What does formatNanoseconds() do?
formatNanoseconds() is a function in the tailwindcss codebase, defined in packages/@tailwindcss-cli/src/utils/format-ns.ts.
Where is formatNanoseconds() defined?
formatNanoseconds() is defined in packages/@tailwindcss-cli/src/utils/format-ns.ts at line 1.
What calls formatNanoseconds()?
formatNanoseconds() is called by 1 function(s): formatDuration.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free