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

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

Analyze Your Own Codebase

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

Try Supermodel Free