Home / Class/ DefaultMap Class — tailwindcss Architecture

DefaultMap Class — tailwindcss Architecture

Architecture documentation for the DefaultMap class in default-map.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  cfb4af0e_7b2d_34a1_693a_90088443cfec["DefaultMap"]
  28a2f72d_350c_6647_bf9d_77c69e637045["default-map.ts"]
  cfb4af0e_7b2d_34a1_693a_90088443cfec -->|defined in| 28a2f72d_350c_6647_bf9d_77c69e637045
  3e0bd1e7_d92a_0fc0_9191_641dab7aed09["constructor()"]
  cfb4af0e_7b2d_34a1_693a_90088443cfec -->|method| 3e0bd1e7_d92a_0fc0_9191_641dab7aed09
  2820372c_b982_9e06_fc23_f8f4ac308d00["get()"]
  cfb4af0e_7b2d_34a1_693a_90088443cfec -->|method| 2820372c_b982_9e06_fc23_f8f4ac308d00

Relationship Graph

Source Code

packages/tailwindcss/src/utils/default-map.ts lines 5–20

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

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

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

    return value
  }
}

Domain

Frequently Asked Questions

What is the DefaultMap class?
DefaultMap is a class in the tailwindcss codebase, defined in packages/tailwindcss/src/utils/default-map.ts.
Where is DefaultMap defined?
DefaultMap is defined in packages/tailwindcss/src/utils/default-map.ts at line 5.

Analyze Your Own Codebase

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

Try Supermodel Free