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
  80b238bf_83b5_f1c4_8bb5_c4c28573f0c8["intersection()"]
  7d350d81_5de1_f9f3_5b2c_19ec8fd3c37e["canonicalize-candidates.ts"]
  80b238bf_83b5_f1c4_8bb5_c4c28573f0c8 -->|defined in| 7d350d81_5de1_f9f3_5b2c_19ec8fd3c37e
  6b36dfc9_f213_8083_55ea_8d0541032f05["collapseCandidates()"]
  6b36dfc9_f213_8083_55ea_8d0541032f05 -->|calls| 80b238bf_83b5_f1c4_8bb5_c4c28573f0c8
  style 80b238bf_83b5_f1c4_8bb5_c4c28573f0c8 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, defined in packages/tailwindcss/src/canonicalize-candidates.ts.
Where is intersection() defined?
intersection() is defined in packages/tailwindcss/src/canonicalize-candidates.ts at line 2602.
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