Skip to content

Commit bf8831e

Browse files
committed
Remove long toString format from MetadataEntry (ambiguous)
1 parent bccdb4c commit bf8831e

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/backends/single_buffer.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@ class MetadataEntry extends BufferView {
3636
/** The size of the data */
3737
@t.uint32 accessor size!: number;
3838

39-
public toString(long: boolean = false) {
40-
if (!long) return `<MetadataEntry @ 0x${this.byteOffset.toString(16).padStart(8, '0')}>`;
41-
42-
return `0x${this.id.toString(16).padStart(8, '0')}: ${format(this.size).padStart(5)} at 0x${this.offset.toString(16).padStart(8, '0')}`;
39+
public toString() {
40+
return `<MetadataEntry @ 0x${this.byteOffset.toString(16).padStart(8, '0')}>`;
4341
}
4442
}
4543

@@ -89,20 +87,20 @@ export class MetadataBlock extends Int32Array<ArrayBufferLike> {
8987
/** Metadata entries. */
9088
@field(MetadataEntry, { length: entries_per_block }) accessor items!: StructArray<MetadataEntry>;
9189

92-
toString(long: boolean = false) {
90+
public toString(long: boolean = false): string {
9391
if (!long) return `<MetadataBlock @ ${this.offsetHex}>`;
9492

9593
let text = [
96-
`----- Metadata block at ${this.offsetHex} -----`,
97-
'Checksum: ' + this.checksum.toString(16).padStart(8, '0'),
98-
'Last updated: ' + new Date(Number(this.timestamp)).toLocaleString(),
99-
'Previous block: 0x' + this.previous_offset.toString(16).padStart(8, '0'),
94+
`---- Metadata block at ${this.offsetHex} ----`,
95+
`Checksum: 0x${this.checksum.toString(16).padStart(8, '0')}`,
96+
`Last updated: ${new Date(Number(this.timestamp)).toLocaleString()}`,
97+
`Previous block: 0x${this.previous_offset.toString(16).padStart(8, '0')}`,
10098
'Entries:',
10199
].join('\n');
102100

103101
for (const entry of this.items) {
104102
if (!entry.offset) continue;
105-
text += '\n\t' + entry.toString(long);
103+
text += `\n\t0x${entry.id.toString(16).padStart(8, '0')}: ${format(entry.size).padStart(5)} at 0x${entry.offset.toString(16).padStart(8, '0')}`;
106104
}
107105

108106
return text;

0 commit comments

Comments
 (0)