Home / File/ format-ns.ts — tailwindcss Source File

format-ns.ts — tailwindcss Source File

Architecture documentation for format-ns.ts, a typescript file in the tailwindcss codebase. 0 imports, 2 dependents.

File typescript BuildIntegrations VitePlugin 2 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  006812b4_db51_3f0a_2f42_88cad1754730["format-ns.ts"]
  cf200d82_caf5_2f83_f51a_aec1801af6b0["format-ns.test.ts"]
  cf200d82_caf5_2f83_f51a_aec1801af6b0 --> 006812b4_db51_3f0a_2f42_88cad1754730
  8715b8e3_2ef0_3a5f_beb9_7129d3febc3e["renderer.ts"]
  8715b8e3_2ef0_3a5f_beb9_7129d3febc3e --> 006812b4_db51_3f0a_2f42_88cad1754730
  style 006812b4_db51_3f0a_2f42_88cad1754730 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

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

Frequently Asked Questions

What does format-ns.ts do?
format-ns.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the BuildIntegrations domain, VitePlugin subdomain.
What functions are defined in format-ns.ts?
format-ns.ts defines 1 function(s): formatNanoseconds.
What files import format-ns.ts?
format-ns.ts is imported by 2 file(s): format-ns.test.ts, renderer.ts.
Where is format-ns.ts in the architecture?
format-ns.ts is located at packages/@tailwindcss-cli/src/utils/format-ns.ts (domain: BuildIntegrations, subdomain: VitePlugin, directory: packages/@tailwindcss-cli/src/utils).

Analyze Your Own Codebase

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

Try Supermodel Free