Skip to content

Commit 5bcc10d

Browse files
committed
style: run Prettier
1 parent 2bc56b1 commit 5bcc10d

File tree

4 files changed

+104
-101
lines changed

4 files changed

+104
-101
lines changed

src/xdr/XdrDecoder.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,17 @@ export class XdrDecoder<R extends IReader & IReaderResettable = IReader & IReade
123123
public readOpaque(size: number): Uint8Array {
124124
const reader = this.reader;
125125
const data = new Uint8Array(size);
126-
126+
127127
// Read actual data
128128
for (let i = 0; i < size; i++) {
129129
data[i] = reader.u8();
130130
}
131-
131+
132132
// Skip padding bytes to reach 4-byte boundary
133133
const paddedSize = Math.ceil(size / 4) * 4;
134134
const padding = paddedSize - size;
135135
reader.skip(padding);
136-
136+
137137
return data;
138138
}
139139

@@ -153,18 +153,18 @@ export class XdrDecoder<R extends IReader & IReaderResettable = IReader & IReade
153153
public readString(): string {
154154
const size = this.readUnsignedInt();
155155
const reader = this.reader;
156-
156+
157157
// Read UTF-8 bytes
158158
const utf8Bytes = new Uint8Array(size);
159159
for (let i = 0; i < size; i++) {
160160
utf8Bytes[i] = reader.u8();
161161
}
162-
162+
163163
// Skip padding bytes to reach 4-byte boundary
164164
const paddedSize = Math.ceil(size / 4) * 4;
165165
const padding = paddedSize - size;
166166
reader.skip(padding);
167-
167+
168168
// Decode UTF-8 to string
169169
return new TextDecoder('utf-8').decode(utf8Bytes);
170170
}
@@ -196,4 +196,4 @@ export class XdrDecoder<R extends IReader & IReaderResettable = IReader & IReade
196196
const size = this.readUnsignedInt();
197197
return this.readArray(size, elementReader);
198198
}
199-
}
199+
}

src/xdr/XdrSchemaDecoder.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,14 @@ export class XdrSchemaDecoder {
9292
*/
9393
private readEnum(schema: XdrEnumSchema): string | number {
9494
const value = this.decoder.readEnum();
95-
95+
9696
// Find the enum name for this value
9797
for (const [name, enumValue] of Object.entries(schema.values)) {
9898
if (enumValue === value) {
9999
return name;
100100
}
101101
}
102-
102+
103103
// If no matching name found, return the numeric value
104104
return value;
105105
}
@@ -116,12 +116,12 @@ export class XdrSchemaDecoder {
116116
*/
117117
private readVarlenOpaque(schema: XdrVarlenOpaqueSchema): Uint8Array {
118118
const data = this.decoder.readVarlenOpaque();
119-
119+
120120
// Check size constraint if specified
121121
if (schema.size !== undefined && data.length > schema.size) {
122122
throw new Error(`Variable-length opaque data size ${data.length} exceeds maximum ${schema.size}`);
123123
}
124-
124+
125125
return data;
126126
}
127127

@@ -130,12 +130,12 @@ export class XdrSchemaDecoder {
130130
*/
131131
private readString(schema: XdrStringSchema): string {
132132
const str = this.decoder.readString();
133-
133+
134134
// Check size constraint if specified
135135
if (schema.size !== undefined && str.length > schema.size) {
136136
throw new Error(`String length ${str.length} exceeds maximum ${schema.size}`);
137137
}
138-
138+
139139
return str;
140140
}
141141

@@ -151,12 +151,12 @@ export class XdrSchemaDecoder {
151151
*/
152152
private readVarlenArray(schema: XdrVarlenArraySchema): unknown[] {
153153
const array = this.decoder.readVarlenArray(() => this.readValue(schema.elements));
154-
154+
155155
// Check size constraint if specified
156156
if (schema.size !== undefined && array.length > schema.size) {
157157
throw new Error(`Variable-length array size ${array.length} exceeds maximum ${schema.size}`);
158158
}
159-
159+
160160
return array;
161161
}
162162

@@ -165,11 +165,11 @@ export class XdrSchemaDecoder {
165165
*/
166166
private readStruct(schema: XdrStructSchema): Record<string, unknown> {
167167
const struct: Record<string, unknown> = {};
168-
168+
169169
for (const [fieldSchema, fieldName] of schema.fields) {
170170
struct[fieldName] = this.readValue(fieldSchema);
171171
}
172-
172+
173173
return struct;
174174
}
175175

@@ -179,21 +179,21 @@ export class XdrSchemaDecoder {
179179
private readUnion(schema: XdrUnionSchema): XdrUnion {
180180
// Read discriminant
181181
const discriminant = this.decoder.readInt();
182-
182+
183183
// Find matching arm
184184
for (const [armDiscriminant, armSchema] of schema.arms) {
185185
if (armDiscriminant === discriminant) {
186186
const value = this.readValue(armSchema);
187187
return new XdrUnion(discriminant, value);
188188
}
189189
}
190-
190+
191191
// If no matching arm found, try default
192192
if (schema.default) {
193193
const value = this.readValue(schema.default);
194194
return new XdrUnion(discriminant, value);
195195
}
196-
196+
197197
throw new Error(`No matching union arm for discriminant: ${discriminant}`);
198198
}
199-
}
199+
}

0 commit comments

Comments
 (0)