Skip to content

Commit

Permalink
pretty (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
volovyks authored Dec 2, 2021
1 parent b80a6d4 commit 8eeabaf
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions borsh-ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import bs58 from "bs58";
// TODO: Make sure this polyfill not included when not required
import * as encoding from "text-encoding-utf-8";
const ResolvedTextDecoder =
typeof TextDecoder !== "function"
? encoding.TextDecoder
: TextDecoder;
typeof TextDecoder !== "function" ? encoding.TextDecoder : TextDecoder;
const textDecoder = new ResolvedTextDecoder("utf-8", { fatal: true });

export function baseEncode(value: Uint8Array | string): string {
Expand Down Expand Up @@ -397,10 +395,15 @@ function deserializeField(
const length = reader.readU32();
for (let i = 0; i < length; i++) {
const key = deserializeField(schema, fieldName, fieldType.key, reader);
const val = deserializeField(schema, fieldName, fieldType.value, reader);
const val = deserializeField(
schema,
fieldName,
fieldType.value,
reader
);
map.set(key, val);
}
return map
return map;
}

return deserializeStruct(schema, fieldType, reader);
Expand Down

0 comments on commit 8eeabaf

Please sign in to comment.