diff options
author | Louis Pilfold <louis@lpil.uk> | 2021-08-26 22:03:21 +0100 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2021-08-26 22:03:21 +0100 |
commit | 0d6bf1f289cc6cb247afff8c5f2cdc2277ac94c6 (patch) | |
tree | 851e1348022247b8a47a90e9fd7fd4c49787f710 | |
parent | 682c1467ccbc33c01ca4f304dcde79c375b82257 (diff) | |
download | gleam_stdlib-0d6bf1f289cc6cb247afff8c5f2cdc2277ac94c6.tar.gz gleam_stdlib-0d6bf1f289cc6cb247afff8c5f2cdc2277ac94c6.zip |
Fix codepoint
-rw-r--r-- | src/gleam/string.gleam | 2 | ||||
-rw-r--r-- | src/gleam_stdlib.js | 5 |
2 files changed, 6 insertions, 1 deletions
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); +} |