diff options
author | rubytree <rt@rubytree.me> | 2023-03-30 17:41:10 +0200 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2023-05-13 16:32:38 +0100 |
commit | ae0021a2025c9adc6e336cacab750dd2271365e2 (patch) | |
tree | a3657fc66a6cee8de87d44c3a19c99e149ea03d7 /src/gleam_stdlib.mjs | |
parent | 8e92e3e87602f6cbb38291dee18d9068148c9da6 (diff) | |
download | gleam_stdlib-ae0021a2025c9adc6e336cacab750dd2271365e2.tar.gz gleam_stdlib-ae0021a2025c9adc6e336cacab750dd2271365e2.zip |
Fixes #420
Diffstat (limited to 'src/gleam_stdlib.mjs')
-rw-r--r-- | src/gleam_stdlib.mjs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gleam_stdlib.mjs b/src/gleam_stdlib.mjs index bbbd06a..102158c 100644 --- a/src/gleam_stdlib.mjs +++ b/src/gleam_stdlib.mjs @@ -616,6 +616,10 @@ export function decode_tuple(data) { return Array.isArray(data) ? new Ok(data) : decoder_error("Tuple", data); } +export function list_to_tuple(data) { + return List.isList(data) ? new Ok([...data]) : decoder_error("List", data); +} + export function tuple_get(data, index) { return index >= 0 && data.length > index ? new Ok(data[index]) |