diff options
author | inoas <mail@inoas.com> | 2022-11-29 07:38:19 +0100 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2022-12-22 20:44:33 +0000 |
commit | 86532391dac84e5136031940db962d45a7814a02 (patch) | |
tree | 3dca09c98ce5eed790dd8f30e3d0c428f99973c1 /src | |
parent | 04b84338c488c38a6d180149277f9ca943a38415 (diff) | |
download | gleam_stdlib-86532391dac84e5136031940db962d45a7814a02.tar.gz gleam_stdlib-86532391dac84e5136031940db962d45a7814a02.zip |
readd tests
Diffstat (limited to 'src')
-rw-r--r-- | src/gleam_stdlib.mjs | 14 |
1 files changed, 14 insertions, 0 deletions
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); } |