Home / Function/ formatRange() — tailwindcss Function Reference

formatRange() — tailwindcss Function Reference

Architecture documentation for the formatRange() function in source-map.test.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  f28c8284_0ba1_baec_355a_ee2413e33842["formatRange()"]
  685d98f0_f223_dedf_cfba_bbdb2dc11d1d["source-map.test.ts"]
  f28c8284_0ba1_baec_355a_ee2413e33842 -->|defined in| 685d98f0_f223_dedf_cfba_bbdb2dc11d1d
  bcca3c2e_b934_8f1e_1d12_56bb89daae2b["formattedMappings()"]
  bcca3c2e_b934_8f1e_1d12_56bb89daae2b -->|calls| f28c8284_0ba1_baec_355a_ee2413e33842
  style f28c8284_0ba1_baec_355a_ee2413e33842 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/source-maps/source-map.test.ts lines 132–147

function formatRange(range: { start: [number, number]; end: [number, number] }) {
  if (range.start[0] === range.end[0]) {
    // This range is on the same line
    // and the columns are the same
    if (range.start[1] === range.end[1]) {
      return `${range.start[0]}:${range.start[1]}`
    }

    // This range is on the same line
    // but the columns are different
    return `${range.start[0]}:${range.start[1]}-${range.end[1]}`
  }

  // This range spans multiple lines
  return `${range.start[0]}:${range.start[1]}-${range.end[0]}:${range.end[1]}`
}

Domain

Subdomains

Frequently Asked Questions

What does formatRange() do?
formatRange() is a function in the tailwindcss codebase, defined in packages/tailwindcss/src/source-maps/source-map.test.ts.
Where is formatRange() defined?
formatRange() is defined in packages/tailwindcss/src/source-maps/source-map.test.ts at line 132.
What calls formatRange()?
formatRange() is called by 1 function(s): formattedMappings.

Analyze Your Own Codebase

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

Try Supermodel Free