node-red-contrib-buffer-parser
Advanced tools
Comparing version 3.1.2 to 3.1.3
@@ -141,6 +141,13 @@ | ||
//compile scaler | ||
var scale = formattedSpecItem.scale && formattedSpecItem.scale.trim(); | ||
let scale = null; | ||
if(formattedSpecItem.scale) { | ||
if(typeof formattedSpecItem.scale == "number") { | ||
scale = formattedSpecItem.scale.toString(); | ||
} else { | ||
scale = formattedSpecItem.scale && formattedSpecItem.scale.trim(); | ||
} | ||
} | ||
if (scale) { | ||
try { | ||
var scale = formattedSpecItem.scale.trim(); | ||
if (scale != "1" && scale != "0") { | ||
@@ -147,0 +154,0 @@ if (isNumber(scale)) { |
{ | ||
"name": "node-red-contrib-buffer-parser", | ||
"version": "3.1.2", | ||
"version": "3.1.3", | ||
"description": "Node-red nodes to convert values to and from buffer/array. Supports Big/Little Endian, BCD, byte swapping and much more", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -86,16 +86,16 @@ node-red-contrib-buffer-parser | ||
* Supported Scaling Equations are... | ||
* `<<` (e.g. `<<2` would left shift the parsed value 2 places | ||
* `>>` (e.g. `>>2` would right shift the parsed value 2 places | ||
* `>>>` (e.g. `>>>2` would zero-fill right shift the parsed value 2 places (returns a 32bit unsigned value) | ||
* `+` (e.g. `+10` would add 10 to the parsed value | ||
* `-` (e.g. `-10` would deduct 10 from the parsed value | ||
* `/` (e.g. `/10` would divide the parsed value by 10 | ||
* `*` (e.g. `*10` would multiply the parsed value by 10 | ||
* `**` (e.g. `**2` would raise the parsed value to the power of 2 | ||
* `^` (e.g. `^0xf0` would XOR the parsed value with 0xf0 | ||
* `==` (e.g. `==10` would result in `true` if the parsed value was equal to 10 | ||
* `!=` (e.g. `!=10` would result in `false` if the parsed value was equal to 10 | ||
* `!!` (e.g. `!!` would result in `true` if the parsed value was `1` (same as `!!1 == true`) | ||
* `>` (e.g. `>10` would result in `true` if the parsed value was greater than 10 | ||
* `<` (e.g. `<10` would result in `true` if the parsed value was less than 10 | ||
* `<<` e.g. `<<2` would left shift the parsed value 2 places | ||
* `>>` e.g. `>>2` would right shift the parsed value 2 places | ||
* `>>>` e.g. `>>>2` would zero-fill right shift the parsed value 2 places (returns a 32bit unsigned value) | ||
* `+` e.g. `+10` would add 10 to the parsed value | ||
* `-` e.g. `-10` would deduct 10 from the parsed value | ||
* `/` e.g. `/10` would divide the parsed value by 10 | ||
* `*` e.g. `*10` would multiply the parsed value by 10 | ||
* `**` e.g. `**2` would raise the parsed value to the power of 2 | ||
* `^` e.g. `^0xf0` would XOR the parsed value with 0xf0 | ||
* `==` e.g. `==10` would result in `true` if the parsed value was equal to 10 | ||
* `!=` e.g. `!=10` would result in `false` if the parsed value was equal to 10 | ||
* `!!` e.g. `!!` would result in `true` if the parsed value was `1` (same as `!!1 == true`) | ||
* `>` e.g. `>10` would result in `true` if the parsed value was greater than 10 | ||
* `<` e.g. `<10` would result in `true` if the parsed value was less than 10 | ||
* NOTE: the scale/equation is applied AFTER the mask | ||
@@ -102,0 +102,0 @@ * Final values can be have a scale applied (e.g. a scale of `0.01` would turn `9710` into `97.1` or a scale of 10 would turn `50` into `500`) |
625107
1538