namespace PkmnLib.Static.Utils;

/// <summary>
/// Helpers for working with dictionaries.
/// </summary>
public static class DictionaryHelpers
{
    /// <summary>
    /// Gets the value for a key in a dictionary, or returns a default value if the key is not found.
    /// </summary>
    public static TValue GetOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key,
        TValue defaultValue) =>
        dictionary.TryGetValue(key, out var value) ? value : defaultValue;
}