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
  668a6c78_97ae_1a3a_8906_d42fe854fff0["format-ns.ts"]
  e0e4b353_1746_cf12_c054_4c01c910409f["format-ns.test.ts"]
  e0e4b353_1746_cf12_c054_4c01c910409f --> 668a6c78_97ae_1a3a_8906_d42fe854fff0
  cc1a3f06_4b21_684c_487a_f342bd18d772["renderer.ts"]
  cc1a3f06_4b21_684c_487a_f342bd18d772 --> 668a6c78_97ae_1a3a_8906_d42fe854fff0
  style 668a6c78_97ae_1a3a_8906_d42fe854fff0 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-cli/src/utils/format-ns.ts (domain: CommandLineInterface, subdomain: Renderer, 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