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
  507c448e_5842_d4c4_3fb0_f2bef2d0ea41["formatRange()"]
  b481c171_0dab_e8e5_e9d7_4ad779fa96da["source-map.test.ts"]
  507c448e_5842_d4c4_3fb0_f2bef2d0ea41 -->|defined in| b481c171_0dab_e8e5_e9d7_4ad779fa96da
  2a01344b_c5b0_dcf1_e07d_40f1d5d4790e["formattedMappings()"]
  2a01344b_c5b0_dcf1_e07d_40f1d5d4790e -->|calls| 507c448e_5842_d4c4_3fb0_f2bef2d0ea41
  style 507c448e_5842_d4c4_3fb0_f2bef2d0ea41 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