Skip to content

Commit

Permalink
refactor: revert some changes proposed by @JKRhb
Browse files Browse the repository at this point in the history
leads to different results
  • Loading branch information
danielpeintner committed Sep 20, 2023
1 parent 88330e2 commit a04d8c7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/td-tools/src/thing-model-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export class ThingModelHelpers {
case "http": {
return new Promise((resolve, reject) => {
http.get(uri, (res) => {
if (res?.statusCode !== 200) {
if (res.statusCode == null || res.statusCode !== 200) {
reject(new Error(`http status code not 200 but ${res.statusCode} for ${uri}`));
}

Expand All @@ -268,7 +268,7 @@ export class ThingModelHelpers {
return new Promise((resolve, reject) => {
https
.get(uri, (res) => {
if (res?.statusCode !== 200) {
if (res.statusCode == null || res.statusCode !== 200) {
reject(new Error(`https status code not 200 but ${res.statusCode} for ${uri}`));
}

Expand Down Expand Up @@ -625,7 +625,7 @@ export class ThingModelHelpers {
keys = keys.map((el) => el.replace("{{", "").replace("}}", ""));
let isValid = true;
let errors;
if ((keys ?? []).length > 0 && map == null) {
if (keys != null && keys.length > 0 && (map === undefined || map === null)) {
isValid = false;
errors = `No map provided for model ${model.title}`;
} else if (keys.length > 0) {
Expand Down

0 comments on commit a04d8c7

Please sign in to comment.