@s-libs/js-core
    Preparing search index...

    Class MagicalMap<Key, Value>

    A map where calling .get() will add a value to the map before returning it, if it does not yet exist.

    const tallies = new MagicalMap<string, number>(() => 0);
    tallies.get('joe'); // 0
    tallies.set('fred', tallies.get('fred') + 1);
    tallies.get('fred'); // 1

    Type Parameters

    • Key
    • Value
    Index

    Constructors

    Methods

    Constructors

    Methods