Skip to content

Commit

Permalink
fix cast from boolean to integer for enums (rdmtc/RedMatic#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
hobbyquaker committed Oct 22, 2018
1 parent e6f3fb5 commit 8f5c361
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion nodes/ccu-connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -1731,7 +1731,11 @@ module.exports = function (RED) {
}
// eslint-disable-line no-fallthrough
case 'INTEGER':
value = parseInt(value, 10);
if (typeof value === 'boolean') {
value = Number(value);
} else {
value = parseInt(value, 10) || 0;
}
if (typeof paramset.MIN !== 'undefined' && value < paramset.MIN) {
value = paramset.MIN;
} else if (typeof paramset.MAX !== 'undefined' && value > paramset.MAX) {
Expand Down

0 comments on commit 8f5c361

Please sign in to comment.