npm run format:write

This commit is contained in:
2024-12-25 23:15:10 -06:00
parent 83a0deab20
commit 67dbe076c3
3 changed files with 7 additions and 12 deletions
+3 -3
View File
@@ -97,12 +97,12 @@ export function decode(bytes: Uint8Array): DDPPacket {
dataLength, dataLength,
}; };
let dataStart = 10 let dataStart = 10;
if (flags.timecode) { if (flags.timecode) {
if (bytes.length < 14) { if (bytes.length < 14) {
throw new Error('DDP packet with timecode must be at least 14 bytes'); throw new Error('DDP packet with timecode must be at least 14 bytes');
} }
dataStart = 14 dataStart = 14;
header.timecode = { header.timecode = {
seconds: (bytes[10] << 8) + bytes[11], seconds: (bytes[10] << 8) + bytes[11],
fractionalSeconds: (bytes[12] << 8) + bytes[13], fractionalSeconds: (bytes[12] << 8) + bytes[13],
@@ -111,6 +111,6 @@ export function decode(bytes: Uint8Array): DDPPacket {
return { return {
header, header,
data: bytes.subarray(dataStart) data: bytes.subarray(dataStart),
}; };
} }
+2 -3
View File
@@ -26,7 +26,7 @@ const goodTests = [
dataOffset: 1164413200, dataOffset: 1164413200,
dataLength: 4113, dataLength: 4113,
}, },
data: new Uint8Array([]) data: new Uint8Array([]),
}, },
}, },
{ {
@@ -56,8 +56,7 @@ const goodTests = [
fractionalSeconds: 4368, fractionalSeconds: 4368,
}, },
}, },
data: new Uint8Array([]) data: new Uint8Array([]),
}, },
}, },
]; ];
+2 -6
View File
@@ -2,13 +2,9 @@ const { deepEqual, throws } = require('assert');
const { describe, it } = require('node:test'); const { describe, it } = require('node:test');
const ddp = require('../dist/cjs/index'); const ddp = require('../dist/cjs/index');
const goodTests = [ const goodTests = [];
];
const badTests = [ const badTests = [];
];
describe('DDP Message Encoding Pass', () => { describe('DDP Message Encoding Pass', () => {
goodTests.forEach((messageTest) => { goodTests.forEach((messageTest) => {