aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gleam_stdlib.mjs2
-rw-r--r--test/gleam/string_test.gleam6
2 files changed, 7 insertions, 1 deletions
diff --git a/src/gleam_stdlib.mjs b/src/gleam_stdlib.mjs
index 65e7a3e..19a43b1 100644
--- a/src/gleam_stdlib.mjs
+++ b/src/gleam_stdlib.mjs
@@ -256,7 +256,7 @@ const unicode_whitespaces = [
"\u0085", // Next line
"\u2028", // Line separator
"\u2029", // Paragraph separator
-].join();
+].join("");
const left_trim_regex = new RegExp(`^([${unicode_whitespaces}]*)`, "g");
const right_trim_regex = new RegExp(`([${unicode_whitespaces}]*)$`, "g");
diff --git a/test/gleam/string_test.gleam b/test/gleam/string_test.gleam
index a9acf21..6a389d7 100644
--- a/test/gleam/string_test.gleam
+++ b/test/gleam/string_test.gleam
@@ -358,6 +358,12 @@ pub fn trim_zero_width_non_breaking_space_test() {
|> should.equal("hats\u{FEFF}")
}
+pub fn trim_comma_test() {
+ "hats,"
+ |> string.trim
+ |> should.equal(",hats,")
+}
+
pub fn starts_with_test() {
"theory"
|> string.starts_with("")