Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox authored Feb 13, 2020
1 parent 77e2545 commit aa568ea
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,11 @@ class WebServer {
this._addID2entity(obj._id, entity);
this._entity2ID[entity.entity_id] = entity;
const foundIndex = this._entities.findIndex(x => x.entity_id === entity.entity_id);
if (foundIndex != -1) {this._entities[foundIndex] = entity;} else {this._entities.push(entity);}
if (foundIndex !== -1) {
this._entities[foundIndex] = entity;
} else {
this._entities.push(entity);
}
return entity;
}

Expand Down Expand Up @@ -2512,8 +2516,11 @@ class WebServer {
}
};

const foundIndex = this._entities.findIndex(x => x.entity_id === entity.entity_id);
if (foundIndex != -1) {this._entities[foundIndex] = entity;}
const foundIndex = this._entities.findIndex(x => x.entity_id === entity.entity_id);
if (foundIndex !== -1) {
this._entities[foundIndex] = entity;
}

this._wss.clients.forEach(ws => {
if (ws._subscribes && ws._subscribes.state_changed) {
ws._subscribes.state_changed.forEach(id => {
Expand All @@ -2533,7 +2540,9 @@ class WebServer {
if (!id) {
return;
}
if (!objects[id]) { //object might be deleted but still in room/func enums.

// object might be deleted but still in room/func enums.
if (!objects[id]) {
return;
}

Expand Down Expand Up @@ -2571,8 +2580,7 @@ class WebServer {

const _entity = result.find(e => e.entity_id === entity.entity_id);
if (_entity) {
this.log.debug('Duplicates found for ' + entity.entity_id);
return;
return this.log.debug('Duplicates found for ' + entity.entity_id);
}

result.push(entity);
Expand Down

0 comments on commit aa568ea

Please sign in to comment.