From 942521b3016af2f24bff4eb1237c01a7856ffea5 Mon Sep 17 00:00:00 2001 From: Louis Pilfold Date: Fri, 30 Jul 2021 21:43:16 +0100 Subject: Update for new bit string impl on JS --- src/gleam_stdlib.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gleam_stdlib.js b/src/gleam_stdlib.js index ff0921d..68ab895 100644 --- a/src/gleam_stdlib.js +++ b/src/gleam_stdlib.js @@ -107,7 +107,7 @@ export function join(xs) { } export function byte_size(data) { - if (data instanceof ArrayBuffer) { + if (data instanceof Uint8Array) { return data.byteLength; } else if (typeof Blob === "function") { return new Blob([data]).size; @@ -162,14 +162,14 @@ export function trim_right(string) { } export function bit_string_from_string(string) { - return new TextEncoder().encode(string).buffer; + return new TextEncoder().encode(string); } export function bit_string_append(first, second) { let array = new Uint8Array(first.byteLength + second.byteLength); - array.set(new Uint8Array(first), 0); - array.set(new Uint8Array(second), first.byteLength); - return array.buffer; + array.set(first, 0); + array.set(second, first.byteLength); + return array; } export function log(term) { -- cgit v1.2.3