(
aI: number,
)
| 462 | } |
| 463 | |
| 464 | async #decodeSix( |
| 465 | aI: number, |
| 466 | ): Promise< |
| 467 | Date | CborTag<CborStreamOutput> | [ |
| 468 | CborTag<CborStreamOutput>, |
| 469 | lock: Promise<unknown>, |
| 470 | ] |
| 471 | > { |
| 472 | const tagNumber = await this.#decodeZero(aI); |
| 473 | const tagContent = await this.#decode( |
| 474 | arrayToNumber((await this.#read(1, true)).buffer, true) as number, |
| 475 | ); |
| 476 | switch (tagNumber) { |
| 477 | case 0: |
| 478 | if (typeof tagContent !== "string") { |
| 479 | throw new TypeError( |
| 480 | "Invalid DataItem: Expected text string to follow tag number 0", |
| 481 | ); |
| 482 | } |
| 483 | return new Date(tagContent); |
| 484 | case 1: |
| 485 | if (typeof tagContent !== "number" && typeof tagContent !== "bigint") { |
| 486 | throw new TypeError( |
| 487 | "Invalid DataItem: Expected integer or float to follow tagNumber 1", |
| 488 | ); |
| 489 | } |
| 490 | return new Date(Number(tagContent) * 1000); |
| 491 | } |
| 492 | if (tagContent instanceof Array) { |
| 493 | return [new CborTag(tagNumber, tagContent[0]), tagContent[1]]; |
| 494 | } |
| 495 | return new CborTag(tagNumber, tagContent); |
| 496 | } |
| 497 | |
| 498 | async #decodeSeven(aI: number): Promise<undefined | null | boolean | number> { |
| 499 | switch (aI) { |
no test coverage detected