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
  bf2992f6_4a37_8536_70f8_94b13631027d["DefaultMap"]
  c056448b_f7a2_9149_54e8_f0f8470fe3aa["default-map.ts"]
  bf2992f6_4a37_8536_70f8_94b13631027d -->|defined in| c056448b_f7a2_9149_54e8_f0f8470fe3aa
  81e29ae1_91f1_d93d_033e_16e05925d7ef["constructor()"]
  bf2992f6_4a37_8536_70f8_94b13631027d -->|method| 81e29ae1_91f1_d93d_033e_16e05925d7ef
  5bcf4886_1230_a8ff_7302_a26cc5a9a525["get()"]
  bf2992f6_4a37_8536_70f8_94b13631027d -->|method| 5bcf4886_1230_a8ff_7302_a26cc5a9a525

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
  }
}

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