Skip to content

Commit

Permalink
toPrimitive CodecMap disableAscii
Browse files Browse the repository at this point in the history
  • Loading branch information
TarikGul committed Mar 21, 2024
1 parent ddedcb2 commit 123737a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/types-codec/src/extended/Map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,15 @@ export class CodecMap<K extends Codec = Codec, V extends Codec = Codec> extends
/**
* @description Converts the value in a best-fit primitive form
*/
public toPrimitive (): AnyJson {
public toPrimitive (disableAscii?: boolean): AnyJson {
const json: Record<string, AnyJson> = {};

for (const [k, v] of this.entries()) {
json[
k instanceof Raw && k.isAscii
k instanceof Raw && !disableAscii && k.isAscii
? k.toUtf8()
: k.toString()
] = v.toPrimitive();
] = v.toPrimitive(disableAscii);
}

return json;
Expand Down

0 comments on commit 123737a

Please sign in to comment.