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

    Class Tally<K>

    Keep counts associated with unique keys.

    const tally = new Tally<string>();
    tally.get('alice'); // 0
    tally.add('alice');
    tally.get('alice'); // 1
    tally.add('alice', 4);
    tally.get('alice'); // 5

    Type Parameters

    • K
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Parameters

      • key: K
      • amount: number = 1

      Returns void