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
  71d7e8ed_526a_e8f2_fddf_555fe17518fc["distance()"]
  a1d91fdc_e00f_534f_abf6_a58adf4778f1["sort-buckets.ts"]
  71d7e8ed_526a_e8f2_fddf_555fe17518fc -->|defined in| a1d91fdc_e00f_534f_abf6_a58adf4778f1
  bbbe5224_64f9_042a_8b85_2e287c62c4d1["sortBuckets()"]
  bbbe5224_64f9_042a_8b85_2e287c62c4d1 -->|calls| 71d7e8ed_526a_e8f2_fddf_555fe17518fc
  style 71d7e8ed_526a_e8f2_fddf_555fe17518fc 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
}

Subdomains

Called By

Frequently Asked Questions

What does distance() do?
distance() is a function in the tailwindcss codebase, defined in packages/@tailwindcss-upgrade/src/codemods/css/sort-buckets.ts.
Where is distance() defined?
distance() is defined in packages/@tailwindcss-upgrade/src/codemods/css/sort-buckets.ts at line 152.
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