aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2021-07-30 21:43:16 +0100
committerLouis Pilfold <louis@lpil.uk>2021-07-30 21:43:16 +0100
commit942521b3016af2f24bff4eb1237c01a7856ffea5 (patch)
tree2de278f750643bb5d2fda3e14750e9c498b00f1c /src
parent12d91899bf20c95c491f1c7323ec9e198208ebac (diff)
downloadgleam_stdlib-942521b3016af2f24bff4eb1237c01a7856ffea5.tar.gz
gleam_stdlib-942521b3016af2f24bff4eb1237c01a7856ffea5.zip
Update for new bit string impl on JS
Diffstat (limited to 'src')
-rw-r--r--src/gleam_stdlib.js10
1 files changed, 5 insertions, 5 deletions
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) {