omron-fins
Advanced tools
Comparing version 0.3.0-beta.1 to 0.4.0-beta.0
@@ -0,1 +1,15 @@ | ||
const allowableTrueValues = { | ||
1: true, | ||
"1": true, | ||
true: true, | ||
"true": true, | ||
"on": true | ||
} | ||
const allowableFalseValues = { | ||
0: true, | ||
"0": true, | ||
false: true, | ||
"false": true, | ||
"off": true | ||
} | ||
function _normaliseBool(value, trueValue, falseValue){ | ||
@@ -5,13 +19,9 @@ if (typeof(value) === 'string'){ | ||
} | ||
switch(value){ | ||
case true: | ||
case "true": | ||
case 1: | ||
case "1": | ||
case "on": | ||
case "yes": | ||
return trueValue; | ||
default: | ||
return falseValue; | ||
if(allowableTrueValues[value]) { | ||
return trueValue == null ? true: trueValue; | ||
} | ||
if(allowableFalseValues[value]) { | ||
return typeof falseValue == "undefined" ? false : falseValue; | ||
} | ||
throw new Error("Invalid boolean value") | ||
} | ||
@@ -18,0 +28,0 @@ |
{ | ||
"name": "omron-fins", | ||
"description": "Node.js implementation of the Omron FINS protocol", | ||
"version": "0.3.0-beta.1", | ||
"version": "0.4.0-beta.0", | ||
"main": "lib/index.js", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -17,2 +17,3 @@ node-omron-fins | ||
## Supported PLCs: | ||
* CP | ||
* CV | ||
@@ -19,0 +20,0 @@ * CS |
Sorry, the diff of this file is not supported yet
72295
1480
430