From 86532391dac84e5136031940db962d45a7814a02 Mon Sep 17 00:00:00 2001 From: inoas Date: Tue, 29 Nov 2022 07:38:19 +0100 Subject: readd tests --- src/gleam_stdlib.mjs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/gleam_stdlib.mjs b/src/gleam_stdlib.mjs index d726421..9d37ec3 100644 --- a/src/gleam_stdlib.mjs +++ b/src/gleam_stdlib.mjs @@ -349,6 +349,20 @@ export function codepoint(int) { return new UtfCodepoint(int); } +export function string_to_codepoint_integer_list(string) { + return List.fromArray( + Array.from(string) + .map(item => item.codePointAt(0)) + ); +} + +export function utf_codepoint_list_to_string(utf_codepoint_integer_list) { + return utf_codepoint_integer_list + .toArray() + .map(x => String.fromCodePoint(x.value)) + .join(""); +} + export function regex_check(regex, string) { return regex.test(string); } -- cgit v1.2.3