Skip to content

Commit

Permalink
replace var with const/let
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkPark committed Dec 11, 2024
1 parent bed48ff commit 7538eab
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions vendor/jooby/mtx1.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// encoded message should be less than this size
// to be able to send to a device
var MAX_DATA_SEGMENT_SIZE = 50;
const MAX_DATA_SEGMENT_SIZE = 50;


/*
Expand All @@ -14,12 +14,7 @@ var MAX_DATA_SEGMENT_SIZE = 50;
* bytes - byte array containing the downlink payload
*/
function encodeDownlink ( input ) {
// input has the following structure:
// {
// field: "value"
// }

var bytes = toBytes(input.data.commands); // FRMPayload (byte array)
let bytes = toBytes(input.data.commands); // FRMPayload (byte array)

// send nothing if not fit in a single data segment
if ( bytes.length > MAX_DATA_SEGMENT_SIZE ) {
Expand Down Expand Up @@ -48,8 +43,8 @@ function encodeDownlink ( input ) {
* data - object representing the decoded payload
*/
function decodeDownlink ( input ) {
var segment = getDataSegment(input.bytes);
var message = null;
const segment = getDataSegment(input.bytes);
let message = null;

// just a single data segment
if ( segment ) {
Expand Down Expand Up @@ -82,8 +77,8 @@ function decodeDownlink ( input ) {
* data - object representing the decoded payload
*/
function decodeUplink ( input ) {
var segment = getDataSegment(input.bytes);
var message = null;
const segment = getDataSegment(input.bytes);
let message = null;

// just a single data segment
if ( segment ) {
Expand Down

0 comments on commit 7538eab

Please sign in to comment.