Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/modules / ___dist / state-tree / UniqueDictionary.js
Size: Mime:
"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;