Repository URL to install this package:
|
Version:
1.2.8 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.UniqueDictionary = void 0;
var _exotic = require("../exotic");
var _random = require("./deps/random");
// @class
// eslint-disable-next-line
var UniqueDictionary = function (Map) {
let Mappy = exports.UniqueDictionary = UniqueDictionary = Map;
let stack = []; // may want index or time?
Mappy.prototype.add = function setOnMap(key, value) {
if (this.has(key)) {
key = key + (0, _random.random)();
}
stack.push(value);
return Map.prototype.set.call(this, key, value);
};
Mappy.prototype.debug = function () {
// console.log(this)
return JSON.stringify((0, _exotic.fromMapToObj)(this), null, 2);
};
Mappy.prototype.last = function () {
return stack[stack.length];
}; // Object.defineProperty(Mappy.prototype, 'debug', {
// configurable: false,
// enumerable: false,
// writable: false,
// value() {
// },
// })
return Mappy;
}(Map);
exports.UniqueDictionary = UniqueDictionary;
var _default = UniqueDictionary;
exports.default = _default;