• Finds the result of calling map.get(key). If there is no result, it instead returns the result of the default function. The Map will also be updated to assign that default value to the given key.

    Type Parameters

    • TKey
    • TValue

    Parameters

    • map: Map<TKey, TValue>

      Map to use.

    • key: TKey

      Key to find the value for.

    • defaultFn: (() => TValue)

      Function to generate default value to insert and return if no result was found.

    Returns TValue

  • Finds the result of calling map.get(key). If there is no result, it instead returns the result of the default function. The Map will also be updated to assign the resolved default value to the given key.

    Type Parameters

    • TKey
    • TValue

    Parameters

    • map: Map<TKey, TValue>

      Map to use.

    • key: TKey

      Key to find the value for.

    • defaultFn: (() => Promise<TValue>)

      Function to generate default value to insert and return if no result was found.

    Returns Promise<TValue>