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 UpgradeToolkit TemplateAnalysis 2 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  5962a7f5_fddb_2d83_4f12_66ebacc2e893["format-ns.ts"]
  77c60205_caa0_9ebf_6c95_8d7252f6e429["format-ns.test.ts"]
  77c60205_caa0_9ebf_6c95_8d7252f6e429 --> 5962a7f5_fddb_2d83_4f12_66ebacc2e893
  9106c15d_cfb8_77f5_665e_9707020b48c8["renderer.ts"]
  9106c15d_cfb8_77f5_665e_9707020b48c8 --> 5962a7f5_fddb_2d83_4f12_66ebacc2e893
  style 5962a7f5_fddb_2d83_4f12_66ebacc2e893 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 UpgradeToolkit domain, TemplateAnalysis 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: UpgradeToolkit, subdomain: TemplateAnalysis, 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