Home / Class/ DefaultMap Class — tailwindcss Architecture

DefaultMap Class — tailwindcss Architecture

Architecture documentation for the DefaultMap class in index.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  a094c89b_2a75_452b_124d_e8172424ea3e["DefaultMap"]
  2edc6732_180e_8223_de2c_856c87ce7657["index.ts"]
  a094c89b_2a75_452b_124d_e8172424ea3e -->|defined in| 2edc6732_180e_8223_de2c_856c87ce7657
  113f5f96_c5f8_e8f1_2488_6c6479714601["constructor()"]
  a094c89b_2a75_452b_124d_e8172424ea3e -->|method| 113f5f96_c5f8_e8f1_2488_6c6479714601
  854399a8_4469_b6f5_7175_5d30bfc94972["get()"]
  a094c89b_2a75_452b_124d_e8172424ea3e -->|method| 854399a8_4469_b6f5_7175_5d30bfc94972

Relationship Graph

Source Code

packages/@tailwindcss-vite/src/index.ts lines 230–245

class DefaultMap<K, V> extends Map<K, V> {
  constructor(private factory: (key: K, self: DefaultMap<K, V>) => V) {
    super()
  }

  get(key: K): V {
    let value = super.get(key)

    if (value === undefined) {
      value = this.factory(key, this)
      this.set(key, value)
    }

    return value
  }
}

Frequently Asked Questions

What is the DefaultMap class?
DefaultMap is a class in the tailwindcss codebase, defined in packages/@tailwindcss-vite/src/index.ts.
Where is DefaultMap defined?
DefaultMap is defined in packages/@tailwindcss-vite/src/index.ts at line 230.

Analyze Your Own Codebase

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

Try Supermodel Free