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
  d10c97e7_f102_49e0_8e10_f57a3a4179b6["formatRange()"]
  e1431d4b_1885_1204_7955_59de26dd3eea["formattedMappings()"]
  e1431d4b_1885_1204_7955_59de26dd3eea -->|calls| d10c97e7_f102_49e0_8e10_f57a3a4179b6
  style d10c97e7_f102_49e0_8e10_f57a3a4179b6 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]}`
}

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