UNPKG

fakexrmeasy

Version:

This project aims to provide mocks already implemented for Web API calls made from Javascript. This is a work in progress and way less mature than [its C# counterpart](https://github.com/jordimontana82/fake-xrm-easy).

53 lines 1.69 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var Dictionary = /** @class */ (function () { function Dictionary(init) { this._keys = []; this._values = []; if (init) { for (var x = 0; x < init.length; x++) { this[init[x].key] = init[x].value; this._keys.push(init[x].key); this._values.push(init[x].value); } } } Dictionary.prototype.add = function (key, value) { this[key] = value; this._keys.push(key); this._values.push(value); }; Dictionary.prototype.set = function (key, value) { this[key] = value; var index = this._keys.indexOf(key, 0); this._values[index] = value; }; Dictionary.prototype.get = function (key) { var index = this._keys.indexOf(key, 0); return this._values[index]; }; Dictionary.prototype.remove = function (key) { var index = this._keys.indexOf(key, 0); this._keys.splice(index, 1); this._values.splice(index, 1); delete this[key]; }; Dictionary.prototype.keys = function () { return this._keys; }; Dictionary.prototype.values = function () { return this._values; }; Dictionary.prototype.containsKey = function (key) { if (typeof this[key] === "undefined") { return false; } return true; }; Dictionary.prototype.toLookup = function () { return this; }; return Dictionary; }()); exports.default = Dictionary; //# sourceMappingURL=Dictionary.js.map