diff options
author | AlexCodesApps <141887614+AlexCodesApps@users.noreply.github.com> | 2024-12-16 23:07:32 +0100 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2024-12-17 15:09:50 +0000 |
commit | f7defd37174e160b66fec01a53f2be56eb530ecd (patch) | |
tree | 0b6305e974726a752f0c082a72dabeb237ddce55 | |
parent | 1a274afc189442e32888f1fd15ce712e86f233ca (diff) | |
download | gleam_stdlib-f7defd37174e160b66fec01a53f2be56eb530ecd.tar.gz gleam_stdlib-f7defd37174e160b66fec01a53f2be56eb530ecd.zip |
fix string.utf_codepoint
-rw-r--r-- | src/gleam/string.gleam | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/gleam/string.gleam b/src/gleam/string.gleam index a87b343..8802f09 100644 --- a/src/gleam/string.gleam +++ b/src/gleam/string.gleam @@ -811,6 +811,7 @@ pub fn utf_codepoint(value: Int) -> Result(UtfCodepoint, Nil) { i if i > 1_114_111 -> Error(Nil) 65_534 | 65_535 -> Error(Nil) i if i >= 55_296 && i <= 57_343 -> Error(Nil) + i if i < 0 -> Error(Nil) i -> Ok(unsafe_int_to_utf_codepoint(i)) } } |