Home / Function/ intersection() — tailwindcss Function Reference

intersection() — tailwindcss Function Reference

Architecture documentation for the intersection() function in canonicalize-candidates.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  ab170d02_96a7_f694_5fc0_cead984d9735["intersection()"]
  71b68838_221b_7f75_2376_3e23d6c37929["collapseCandidates()"]
  71b68838_221b_7f75_2376_3e23d6c37929 -->|calls| ab170d02_96a7_f694_5fc0_cead984d9735
  style ab170d02_96a7_f694_5fc0_cead984d9735 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/canonicalize-candidates.ts lines 2602–2617

function intersection<T>(a: Set<T>, b: Set<T>): Set<T> {
  // @ts-expect-error Set.prototype.intersection is only available in Node.js v22+
  if (typeof a.intersection === 'function') return a.intersection(b)

  // Polyfill for environments that do not support Set.prototype.intersection yet
  if (a.size === 0 || b.size === 0) return new Set<T>()

  let result = new Set<T>(a)
  for (let item of b) {
    if (!result.has(item)) {
      result.delete(item)
    }
  }

  return result
}

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free