devicestack
Advanced tools
Comparing version 1.8.4 to 1.8.5
@@ -255,2 +255,21 @@ var EventEmitter2 = require('eventemitter2').EventEmitter2, | ||
/** | ||
* Checks if the passed argument is an array that contains byte values. | ||
* @param {Array} data The array to be checked. | ||
* @return {Boolean} True if it's a byte array, otherwise false. | ||
*/ | ||
Connection.prototype.isByteArray = function(data) { | ||
if (!data || !_.isArray(data)) { | ||
return false; | ||
} | ||
for (var i = 0, len = data.length; i < len; i++) { | ||
if (data[i] === null || data[i] === undefined || data[i] < 0x00 || data[i] > 0xff) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
}; | ||
/** | ||
* Sends the passing command. | ||
@@ -257,0 +276,0 @@ * Define your own command handling mechanism in extended connection! |
{ | ||
"name": "devicestack", | ||
"version": "1.8.4", | ||
"version": "1.8.5", | ||
"description": "This module helps you to represent a device and its protocol.", | ||
@@ -5,0 +5,0 @@ "private": false, |
@@ -214,2 +214,7 @@ <pre> | ||
### isByteArray | ||
Checks if the passed argument is an array that contains byte values. | ||
- If extending from `require('devicestack').Connection` this function is already defined! | ||
## framehandler(s) | ||
@@ -844,2 +849,6 @@ You can have one or multiple framehandlers. A framhandler receives data from the upper layer and sends it to the lower layer by wrapping some header or footer information. A framehandler receives data from lower layer and sends it to the upper layer by unwrapping some header or footer information. The lowest layer for a framehandler is the device and the topmost ist the connection. | ||
## v1.8.5 | ||
- Connection: added function isByteArray | ||
## v1.8.4 | ||
@@ -846,0 +855,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
105843
2153
939