UNPKG

vastra-radiator-valve

Version:

Node.js library to query and configure Vastra's smart radiator valves.

61 lines (60 loc) 1.85 kB
"use strict"; var __read = (this && this.__read) || function (o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; }; var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); }; Object.defineProperty(exports, "__esModule", { value: true }); var BinaryWriter = /** @class */ (function () { function BinaryWriter() { this.data = []; } /** * Appends a byte array to the data array. * @param b */ BinaryWriter.prototype.write = function (b) { var _a; (_a = this.data).push.apply(_a, __spreadArray([], __read(b), false)); }; /** * Appends a `byte`/`uint8` to the data array. * @param b */ BinaryWriter.prototype.writeUInt8 = function (b) { this.data.push(b & 255); }; /** * Appends a `short`/`uint16` to the data array. * @param s */ BinaryWriter.prototype.writeUInt16 = function (s) { this.data.push((s >> 8) & 255); this.data.push(s & 255); }; BinaryWriter.prototype.toBuffer = function () { return Buffer.from(this.data); }; return BinaryWriter; }()); exports.default = BinaryWriter;