Notary Public Mystifier

    object-set-type
    TypeScript icon, indicating that this package has built-in type declarations

    2.2.1 • Public • Published

    object-set-type

    Downloads Version@npm Version@git CI Docs

    A Set implementation which supports Objects and custom conditions.

    Usage

    const ObjectSet = require('object-set-type');
    
    const set = new ObjectSet();
    set.add(1);
    set.add('Hello');
    set.add({
        a: 1
    });
    set.add({
        a: 1
    });
    
    console.log(set.size); // 3
    Array.from(set); // 1, "Hello", {a: 1}

    Custom comparison logic

    The equals(a,b) method is responsible for comparing two items, and the set logic is based on this. This method can be overwritten to support custom uniqueness logic, e.g., handle objects, but compare only specific properties.

    Documentation

    For detailed documentation see the TypeDocs documentation.

    Keywords

    Install

    npm i object-set-type

    DownloadsWeekly Downloads

    18,724

    Version

    2.2.1

    License

    MIT

    Unpacked Size

    8.52 kB

    Total Files

    8

    Last publish

    Collaborators

    • szikszail