greybel-mock-environment 1.4.5 → 1.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,22 +25,6 @@ var __values = (this && this.__values) || function(o) {
25
25
  };
26
26
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
27
27
  };
28
- var __read = (this && this.__read) || function (o, n) {
29
- var m = typeof Symbol === "function" && o[Symbol.iterator];
30
- if (!m) return o;
31
- var i = m.call(o), r, ar = [], e;
32
- try {
33
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
34
- }
35
- catch (error) { e = { error: error }; }
36
- finally {
37
- try {
38
- if (r && !r.done && (m = i["return"])) m.call(i);
39
- }
40
- finally { if (e) throw e.error; }
41
- }
42
- return ar;
43
- };
44
28
  Object.defineProperty(exports, "__esModule", { value: true });
45
29
  exports.Router = void 0;
46
30
  var computer_1 = require("./computer");
@@ -112,27 +96,15 @@ var Router = /** @class */ (function (_super) {
112
96
  return this;
113
97
  };
114
98
  Router.prototype.findByLanIp = function (ip) {
115
- var e_1, _a;
116
99
  if (this.localIp === ip)
117
100
  return this;
118
- try {
119
- for (var _b = __values(this.devices), _c = _b.next(); !_c.done; _c = _b.next()) {
120
- var _d = __read(_c.value, 2), localIp = _d[0], device = _d[1];
121
- if (localIp === ip)
122
- return device;
123
- }
124
- }
125
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
126
- finally {
127
- try {
128
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
129
- }
130
- finally { if (e_1) throw e_1.error; }
101
+ if (this.devices.has(ip)) {
102
+ return this.devices.get(ip);
131
103
  }
132
104
  return null;
133
105
  };
134
106
  Router.prototype.isDeviceInNetwork = function (target) {
135
- var e_2, _a;
107
+ var e_1, _a;
136
108
  try {
137
109
  for (var _b = __values(this.devices.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
138
110
  var item = _c.value;
@@ -141,12 +113,12 @@ var Router = /** @class */ (function (_super) {
141
113
  }
142
114
  }
143
115
  }
144
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
116
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
145
117
  finally {
146
118
  try {
147
119
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
148
120
  }
149
- finally { if (e_2) throw e_2.error; }
121
+ finally { if (e_1) throw e_1.error; }
150
122
  }
151
123
  return false;
152
124
  };
@@ -156,7 +128,7 @@ var Router = /** @class */ (function (_super) {
156
128
  });
157
129
  };
158
130
  Router.prototype.findDeviceByPort = function (port) {
159
- var e_3, _a;
131
+ var e_2, _a;
160
132
  try {
161
133
  for (var _b = __values(this.devices.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
162
134
  var device = _c.value;
@@ -166,12 +138,12 @@ var Router = /** @class */ (function (_super) {
166
138
  }
167
139
  }
168
140
  }
169
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
141
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
170
142
  finally {
171
143
  try {
172
144
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
173
145
  }
174
- finally { if (e_3) throw e_3.error; }
146
+ finally { if (e_2) throw e_2.error; }
175
147
  }
176
148
  return null;
177
149
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "greybel-mock-environment",
3
- "version": "1.4.5",
3
+ "version": "1.4.6",
4
4
  "description": "Mock environment",
5
5
  "main": "dist/index",
6
6
  "typings": "dist/index",