1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var Registry = (function () {
|
4 | function Registry(entries) {
|
5 | if (entries === void 0) { entries = []; }
|
6 | this.map = new Map(entries);
|
7 | }
|
8 | Object.defineProperty(Registry.prototype, "keys", {
|
9 | get: function () {
|
10 | return this.map.keys();
|
11 | },
|
12 | enumerable: true,
|
13 | configurable: true
|
14 | });
|
15 | Object.defineProperty(Registry.prototype, "values", {
|
16 | get: function () {
|
17 | return this.map.values();
|
18 | },
|
19 | enumerable: true,
|
20 | configurable: true
|
21 | });
|
22 | Registry.prototype.clear = function () {
|
23 | this.map.clear();
|
24 | };
|
25 | Registry.prototype.containsKey = function (key) {
|
26 | return Array.from(this.map.keys()).indexOf(key) > -1;
|
27 | };
|
28 | Registry.prototype.register = function (key, value) {
|
29 | if (this.map.has(key) === false) {
|
30 | this.map.set(key, value);
|
31 | }
|
32 | };
|
33 | Registry.prototype.resolve = function (key) {
|
34 | if (this.map.has(key)) {
|
35 | return this.map.get(key);
|
36 | }
|
37 | return undefined;
|
38 | };
|
39 | Registry.prototype.unregister = function (key) {
|
40 | if (this.map.has(key)) {
|
41 | this.map.delete(key);
|
42 | }
|
43 | };
|
44 | return Registry;
|
45 | }());
|
46 | exports.Registry = Registry;
|
47 |
|
\ | No newline at end of file |