Home / Function/ distance() — tailwindcss Function Reference

distance() — tailwindcss Function Reference

Architecture documentation for the distance() function in sort-buckets.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  7c64ccd9_f19c_c04c_7546_1d83845680a8["distance()"]
  f8da4c29_335c_9511_8ded_97963c8de7d7["sortBuckets()"]
  f8da4c29_335c_9511_8ded_97963c8de7d7 -->|calls| 7c64ccd9_f19c_c04c_7546_1d83845680a8
  style 7c64ccd9_f19c_c04c_7546_1d83845680a8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/@tailwindcss-upgrade/src/codemods/css/sort-buckets.ts lines 152–161

function distance(before?: ChildNode, after?: ChildNode): number | null {
  if (!before || !after) return null
  if (!before.source || !after.source) return null
  if (!before.source.start || !after.source.start) return null
  if (!before.source.end || !after.source.end) return null

  // Compare end of Before, to start of After
  let d = Math.abs(before.source.end.line - after.source.start.line)
  return d
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does distance() do?
distance() is a function in the tailwindcss codebase.
What calls distance()?
distance() is called by 1 function(s): sortBuckets.

Analyze Your Own Codebase

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

Try Supermodel Free