diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..bf28a7f --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,25 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Mocha All", + "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", + "args": [ + "-r", + "ts-node/register", + "--timeout", + "999999", + "--colors", + "${workspaceFolder}/tests/**/*.test.ts", + ], + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen", + "protocol": "inspector" + }, + ] +} \ No newline at end of file diff --git a/src/DPT13.ts b/src/DPT13.ts index 976e320..eecd9bb 100644 --- a/src/DPT13.ts +++ b/src/DPT13.ts @@ -33,7 +33,8 @@ export class DPT13 implements DPT { if (value === undefined || value === null || !Number.isFinite(value)) throw new InvalidValueError(`Value is not viable`) - if (Number.isInteger(value)) + + if (!Number.isInteger(value)) throw new InvalidValueError(`Value ${value} is not an integer`) if (value < this.range[0] || value > this.range[1])