wpilog-parser 3.1.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -207,35 +207,14 @@ function readTimestamp(view, offset, length) {
207
207
  switch (length) {
208
208
  case 1: return BigInt(view.getUint8(offset));
209
209
  case 2: return BigInt(view.getUint16(offset, true));
210
- case 3: {
211
- const b0 = BigInt(view.getUint8(offset));
212
- const b1 = BigInt(view.getUint8(offset + 1));
213
- return BigInt(view.getUint8(offset + 2)) << 16n | b1 << 8n | b0;
214
- }
210
+ case 3: return BigInt(view.getUint16(offset, true) + view.getUint8(offset + 2) * 2 ** 16);
215
211
  case 4: return BigInt(view.getUint32(offset, true));
216
- case 5: {
217
- const b0 = BigInt(view.getUint8(offset));
218
- const b1 = BigInt(view.getUint8(offset + 1));
219
- const b2 = BigInt(view.getUint8(offset + 2));
220
- const b3 = BigInt(view.getUint8(offset + 3));
221
- return BigInt(view.getUint8(offset + 4)) << 32n | b3 << 24n | b2 << 16n | b1 << 8n | b0;
222
- }
223
- case 6: {
224
- const b0 = BigInt(view.getUint8(offset));
225
- const b1 = BigInt(view.getUint8(offset + 1));
226
- const b2 = BigInt(view.getUint8(offset + 2));
227
- const b3 = BigInt(view.getUint8(offset + 3));
228
- const b4 = BigInt(view.getUint8(offset + 4));
229
- return BigInt(view.getUint8(offset + 5)) << 40n | b4 << 32n | b3 << 24n | b2 << 16n | b1 << 8n | b0;
230
- }
212
+ case 5: return BigInt(view.getUint32(offset, true) + view.getUint8(offset + 4) * 2 ** 32);
213
+ case 6: return BigInt(view.getUint32(offset, true) + view.getUint16(offset + 4, true) * 2 ** 32);
231
214
  case 7: {
232
- const b0 = BigInt(view.getUint8(offset));
233
- const b1 = BigInt(view.getUint8(offset + 1));
234
- const b2 = BigInt(view.getUint8(offset + 2));
235
- const b3 = BigInt(view.getUint8(offset + 3));
236
- const b4 = BigInt(view.getUint8(offset + 4));
237
- const b5 = BigInt(view.getUint8(offset + 5));
238
- return BigInt(view.getUint8(offset + 6)) << 48n | b5 << 40n | b4 << 32n | b3 << 24n | b2 << 16n | b1 << 8n | b0;
215
+ const low = view.getUint32(offset, true);
216
+ const high = view.getUint16(offset + 4, true) + view.getUint8(offset + 6) * 2 ** 16;
217
+ return BigInt(high) << 32n | BigInt(low);
239
218
  }
240
219
  case 8: return view.getBigUint64(offset, true);
241
220
  default: throw new RangeError(`Invalid timestamp length ${length}`);
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { o as readRecords, t as catalogEntries, u as diagnostics } from "./catalog-DstFMwwV.mjs";
2
+ import { o as readRecords, t as catalogEntries, u as diagnostics } from "./catalog-BmNQKX4c.mjs";
3
3
  import { Diagnostic, formatDiagnostic } from "nostics";
4
4
  import tab from "@bomb.sh/tab/cac";
5
5
  import { cac } from "cac";
@@ -7,7 +7,7 @@ import oscStatus from "osc-status";
7
7
  import { readFile } from "node:fs/promises";
8
8
  import { encode } from "@toon-format/toon";
9
9
  // package.json
10
- var version = "3.1.0";
10
+ var version = "3.1.1";
11
11
  // src/cli/catalog.ts
12
12
  async function catalogFile(filePath) {
13
13
  let bytes;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export { s as ControlRecordType, a as KnownStructTypeName, c as RecordType, t as catalogEntries, n as decodeRecords, l as isDataRecord, r as parseDataLog, i as parseStructSpecification, o as readRecords } from "./catalog-DstFMwwV.mjs";
1
+ export { s as ControlRecordType, a as KnownStructTypeName, c as RecordType, t as catalogEntries, n as decodeRecords, l as isDataRecord, r as parseDataLog, i as parseStructSpecification, o as readRecords } from "./catalog-BmNQKX4c.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wpilog-parser",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "Read WPILib wpilog data log files in TypeScript & JavaScript",
5
5
  "homepage": "https://github.com/jonahsnider/wpilog-parser#readme",
6
6
  "license": "MIT",