npm package: @particle/device-control-util
Description: Utility classes and functions for Node.js and browsers
Author: Particle Industries, Inc.
Latest version: 1.1.3

# @particle/device-control-util

Utility classes and functions used by other packages in this repository.


## Installation

```shell
npm install @particle/device-control-util --save
```
<!-- private-module-note-start -->

<!-- private-module-note-end -->

## API
<!-- api-docs-start -->
<a name="areEqualArrays"></a>

### areEqualArrays(arr1, arr2) ⇒ <code>Boolean</code>
Compare two array-like objects.

**Kind**: global function  
**Returns**: <code>Boolean</code> - `true` if the arrays are equal or `false` otherwise.  

| Param | Type | Description |
| --- | --- | --- |
| arr1 | <code>Array.&lt;\*&gt;</code> | First array. |
| arr2 | <code>Array.&lt;\*&gt;</code> | Second array. |


* * *

<a name="writeUint32Be"></a>

### writeUint32Be(buf, val, [offs])
Write a 32-bit unsigned integer to a buffer (big-endian).

**Kind**: global function  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| buf | <code>Uint8Array</code> |  | Destination buffer. |
| val | <code>Number</code> |  | Value. |
| [offs] | <code>Number</code> | <code>0</code> | Offset in the destination buffer. |


* * *

<a name="writeUint32Le"></a>

### writeUint32Le(buf, val, [offs])
Write a 32-bit unsigned integer to a buffer (little-endian).

**Kind**: global function  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| buf | <code>Uint8Array</code> |  | Destination buffer. |
| val | <code>Number</code> |  | Value. |
| [offs] | <code>Number</code> | <code>0</code> | Offset in the destination buffer. |


* * *

<a name="writeUint16Be"></a>

### writeUint16Be(buf, val, [offs])
Write a 16-bit unsigned integer to a buffer (big-endian).

**Kind**: global function  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| buf | <code>Uint8Array</code> |  | Destination buffer. |
| val | <code>Number</code> |  | Value. |
| [offs] | <code>Number</code> | <code>0</code> | Offset in the destination buffer. |


* * *

<a name="writeUint16Le"></a>

### writeUint16Le(buf, val, [offs])
Write a 16-bit unsigned integer to a buffer (little-endian).

**Kind**: global function  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| buf | <code>Uint8Array</code> |  | Destination buffer. |
| val | <code>Number</code> |  | Value. |
| [offs] | <code>Number</code> | <code>0</code> | Offset in the destination buffer. |


* * *

<a name="writeUint8"></a>

### writeUint8(buf, val, [offs])
Write an 8-bit unsigned integer to a buffer.

**Kind**: global function  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| buf | <code>Uint8Array</code> |  | Destination buffer. |
| val | <code>Number</code> |  | Value. |
| [offs] | <code>Number</code> | <code>0</code> | Offset in the destination buffer. |


* * *

<a name="readUint32Be"></a>

### readUint32Be(buf, [offs]) ⇒ <code>Number</code>
Read a 32-bit unsigned integer from a buffer (big-endian).

**Kind**: global function  
**Returns**: <code>Number</code> - Value.  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| buf | <code>Uint8Array</code> |  | Source buffer. |
| [offs] | <code>Number</code> | <code>0</code> | Offset in the source buffer. |


* * *

<a name="readUint32Le"></a>

### readUint32Le(buf, [offs]) ⇒ <code>Number</code>
Read a 32-bit unsigned integer from a buffer (little-endian).

**Kind**: global function  
**Returns**: <code>Number</code> - Value.  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| buf | <code>Uint8Array</code> |  | Source buffer. |
| [offs] | <code>Number</code> | <code>0</code> | Offset in the source buffer. |


* * *

<a name="readUint16Be"></a>

### readUint16Be(buf, [offs]) ⇒ <code>Number</code>
Read a 16-bit unsigned integer from a buffer (big-endian).

**Kind**: global function  
**Returns**: <code>Number</code> - Value.  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| buf | <code>Uint8Array</code> |  | Source buffer. |
| [offs] | <code>Number</code> | <code>0</code> | Offset in the source buffer. |


* * *

<a name="readUint16Le"></a>

### readUint16Le(buf, [offs]) ⇒ <code>Number</code>
Read a 16-bit unsigned integer from a buffer (little-endian).

**Kind**: global function  
**Returns**: <code>Number</code> - Value.  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| buf | <code>Uint8Array</code> |  | Source buffer. |
| [offs] | <code>Number</code> | <code>0</code> | Offset in the source buffer. |


* * *

<a name="readUint8"></a>

### readUint8(buf, [offs]) ⇒ <code>Number</code>
Read an 8-bit unsigned integer from a buffer.

**Kind**: global function  
**Returns**: <code>Number</code> - Value.  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| buf | <code>Uint8Array</code> |  | Source buffer. |
| [offs] | <code>Number</code> | <code>0</code> | Offset in the source buffer. |


* * *

<a name="toUint8Array"></a>

### toUint8Array(val) ⇒ <code>Uint8Array</code>
Convert a value to a `Uint8Array`.

**Kind**: global function  

| Param | Type | Description |
| --- | --- | --- |
| val | <code>\*</code> | Value to convert. |


* * *

<a name="concatUint8Arrays"></a>

### concatUint8Arrays(...arrs) ⇒ <code>Uint8Array</code>
Concatenate a number of `Uint8Array` objects.

**Kind**: global function  

| Param | Type | Description |
| --- | --- | --- |
| ...arrs | <code>Uint8Array</code> | Arrays to concatenate. |


* * *


<!-- api-docs-end -->

_NOTE: Unfortunately, docs have a nasty habit of falling out of date. When in doubt, check usage in [tests](./src/index.test.js)_