Skip to content

Commit

Permalink
Fix .find() returing multiples
Browse files Browse the repository at this point in the history
  • Loading branch information
codetheweb committed Feb 16, 2019
1 parent 05d0d73 commit 5fdbd94
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ class TuyaDevice extends EventEmitter {
const thisIP = dataRes.data.ip;

// Add to array if it doesn't exist
if (!this.foundDevices.includes({id: thisID, ip: thisIP})) {
if (!this.foundDevices.some(e => (e.id === thisID && e.ip === thisIP))) {
this.foundDevices.push({id: thisID, ip: thisIP});
}

Expand Down

0 comments on commit 5fdbd94

Please sign in to comment.