Nerdy Poly Millionaires

    @extra-map/compare.min
    TypeScript icon, indicating that this package has built-in type declarations

    2.2.15 • Public • Published

    Compares two maps. 📦 😺 🏃 📼 🌔 📜 📰 📘

    Similar: compare, isEqual.

    This is part of package extra-map.

    This is browserified, minified version of @extra-map/compare.
    It is exported as global variable map_compare.
    CDN: unpkg, jsDelivr.


    map.compare(x, y, [fc], [fm]);
    // x:  a map
    // y:  another map
    // fc: compare function (a, b)
    // fm: map function (v, k, x)
    // → x=y: 0, otherwise: -ve/+ve
    const map = require("extra-map");
    
    var x = new Map([["a", 1], ["b", 2]]);
    var y = new Map([["a", 1], ["b", 2], ["c", 3]]);
    map.compare(x, y);
    // -1
    
    var y = new Map([["a", 1], ["b", 2]]);
    map.compare(x, y);
    // 0
    
    var y = new Map([["a", 1], ["b", -2]]);
    map.compare(x, y);
    // 1
    
    map.compare(x, y, (a, b) => Math.abs(a) - Math.abs(b));
    // 0
    
    map.compare(x, y, null, v => Math.abs(v));
    // 0


    References

    Keywords

    Install

    npm i @extra-map/compare.min

    DownloadsWeekly Downloads

    0

    Version

    2.2.15

    License

    MIT

    Unpacked Size

    6.37 kB

    Total Files

    7

    Last publish

    Collaborators

    • wolfram77