Skip to content

Commit

Permalink
use padStart instead of a loop (#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
NotWearingPants authored Sep 15, 2023
1 parent b6bbee8 commit bda8f3c
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/encodedTokenAttributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ export type EncodedTokenAttributes = number;

export namespace EncodedTokenAttributes {
export function toBinaryStr(encodedTokenAttributes: EncodedTokenAttributes): string {
let r = encodedTokenAttributes.toString(2);
while (r.length < 32) {
r = "0" + r;
}
return r;
return encodedTokenAttributes.toString(2).padStart(32, "0");
}

export function print(encodedTokenAttributes: EncodedTokenAttributes): void {
Expand Down

0 comments on commit bda8f3c

Please sign in to comment.