summaryrefslogtreecommitdiff
path: root/js/util.ts
diff options
context:
space:
mode:
Diffstat (limited to 'js/util.ts')
-rw-r--r--js/util.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/js/util.ts b/js/util.ts
index 6971ca1b9..efe0dcf84 100644
--- a/js/util.ts
+++ b/js/util.ts
@@ -83,3 +83,11 @@ export function notImplemented(): never {
export function unreachable(): never {
throw new Error("Code not reachable");
}
+
+export function hexdump(u8: Uint8Array): string {
+ return Array.prototype.map
+ .call(u8, (x: number) => {
+ return ("00" + x.toString(16)).slice(-2);
+ })
+ .join(" ");
+}