Code coverage report for cjs/util/MapPolyfill.js

Statements: 96.55% (28 / 29)      Branches: 83.33% (5 / 6)      Functions: 100% (6 / 6)      Lines: 96.55% (28 / 29)      Ignored: none     

All files » cjs/util/ » MapPolyfill.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 411 1 5 5 5   1 5 5   1 9 9 8 8 8     1   9   1 1 1     1 1 1 1   1 1 3     1   1  
var MapPolyfill = (function () {
    function MapPolyfill() {
        this.size = 0;
        this._values = [];
        this._keys = [];
    }
    MapPolyfill.prototype.get = function (key) {
        var i = this._keys.indexOf(key);
        return i === -1 ? undefined : this._values[i];
    };
    MapPolyfill.prototype.set = function (key, value) {
        var i = this._keys.indexOf(key);
        if (i === -1) {
            this._keys.push(key);
            this._values.push(value);
            this.size++;
        }
        else {
            this._values[i] = value;
        }
        return this;
    };
    MapPolyfill.prototype.delete = function (key) {
        var i = this._keys.indexOf(key);
        Iif (i === -1) {
            return false;
        }
        this._values.splice(i, 1);
        this._keys.splice(i, 1);
        this.size--;
        return true;
    };
    MapPolyfill.prototype.forEach = function (cb, thisArg) {
        for (var i = 0; i < this.size; i++) {
            cb.call(thisArg, this._values[i], this._keys[i]);
        }
    };
    return MapPolyfill;
})();
exports.MapPolyfill = MapPolyfill;
//# sourceMappingURL=MapPolyfill.js.map