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
  ab728c6b_ae2a_ac38_c6ab_c4cadb282ea4["formatRange()"]
  04267aa2_616f_ba33_2ef5_6f8ad86d4dd3["formattedMappings()"]
  04267aa2_616f_ba33_2ef5_6f8ad86d4dd3 -->|calls| ab728c6b_ae2a_ac38_c6ab_c4cadb282ea4
  style ab728c6b_ae2a_ac38_c6ab_c4cadb282ea4 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.
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