UNPKG

662 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.objectify = exports.multicastGroup = void 0;
4function multicastGroup(universe) {
5 if ((universe > 0 && universe <= 63999) || universe === 64214) {
6 // eslint-disable-next-line no-bitwise
7 return `239.255.${universe >> 8}.${universe & 255}`;
8 }
9 throw new RangeError('universe must be between 1-63999');
10}
11exports.multicastGroup = multicastGroup;
12function objectify(buf) {
13 const data = {};
14 buf.forEach((val, ch) => {
15 if (val > 0)
16 data[ch + 1] = Math.round(val / 2.55);
17 });
18 return data;
19}
20exports.objectify = objectify;