UNPKG

485 BPlain TextView Raw
1export function multicastGroup(universe: number): string {
2 if ((universe > 0 && universe <= 63999) || universe === 64214) {
3 // eslint-disable-next-line no-bitwise
4 return `239.255.${universe >> 8}.${universe & 255}`;
5 }
6 throw new RangeError('universe must be between 1-63999');
7}
8
9export function objectify(buf: Buffer): Record<number, number> {
10 const data = {};
11 buf.forEach((val, ch) => {
12 if (val > 0) data[ch + 1] = Math.round(val / 2.55);
13 });
14 return data;
15}