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 CommandLineInterface Renderer 2 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  563df76b_3493_d61f_154e_4c7cc1eb0d26["format-ns.ts"]
  8ad5b760_bd6b_6cfb_8943_0e4fc3a60001["format-ns.test.ts"]
  8ad5b760_bd6b_6cfb_8943_0e4fc3a60001 --> 563df76b_3493_d61f_154e_4c7cc1eb0d26
  2329d36e_5aa2_4fa5_cf9f_a9c6cc4e1277["renderer.ts"]
  2329d36e_5aa2_4fa5_cf9f_a9c6cc4e1277 --> 563df76b_3493_d61f_154e_4c7cc1eb0d26
  style 563df76b_3493_d61f_154e_4c7cc1eb0d26 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 CommandLineInterface domain, Renderer 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-upgrade/src/utils/format-ns.ts (domain: CommandLineInterface, subdomain: Renderer, directory: packages/@tailwindcss-upgrade/src/utils).

Analyze Your Own Codebase

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

Try Supermodel Free