Create test

This commit is contained in:
morrigan
2019-11-27 14:19:35 +01:00
parent b5941c750c
commit d03f4974ba
6 changed files with 48 additions and 17 deletions

View File

@ -74,3 +74,13 @@ export function decodeMessageBuffer(message: bytes) : MessageBuffer {
}
}
export const int16BEEncode = (value, target, offset) => {
target = target || Buffer.allocUnsafe(2);
return target.writeInt16BE(value, offset);
};
int16BEEncode.bytes = 2;
export const int16BEDecode = data => {
if (data.length < 2) throw RangeError('Could not decode int16BE');
return data.readInt16BE(0);}
int16BEDecode.bytes = 2;