From 0d6bf1f289cc6cb247afff8c5f2cdc2277ac94c6 Mon Sep 17 00:00:00 2001 From: Louis Pilfold Date: Thu, 26 Aug 2021 22:03:21 +0100 Subject: Fix codepoint --- src/gleam/string.gleam | 2 +- src/gleam_stdlib.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gleam/string.gleam b/src/gleam/string.gleam index 3f0ebe5..d9a97fe 100644 --- a/src/gleam/string.gleam +++ b/src/gleam/string.gleam @@ -650,7 +650,7 @@ if erlang { if javascript { external fn unsafe_int_to_utf_codepoint(Int) -> UtfCodepoint = - "../gleam_stdlib.js" "identity" + "../gleam_stdlib.js" "codepoint" } /// Converts an integer to a UtfCodepoint diff --git a/src/gleam_stdlib.js b/src/gleam_stdlib.js index da282fb..c7db142 100644 --- a/src/gleam_stdlib.js +++ b/src/gleam_stdlib.js @@ -3,6 +3,7 @@ import { Error, List, BitString, + UtfCodepoint, toBitString, stringBits, } from "./gleam.js"; @@ -223,3 +224,7 @@ export function bit_string_slice(bits, position, length) { let buffer = new Uint8Array(bits.buffer.buffer, start, Math.abs(length)); return new Ok(new BitString(buffer)); } + +export function codepoint(int) { + return new UtfCodepoint(int); +} -- cgit v1.2.3