From 91c0357c6ca3092525b798ad7dfee79fc308b2b9 Mon Sep 17 00:00:00 2001 From: Louis Pilfold Date: Fri, 6 Aug 2021 14:11:26 +0100 Subject: Fix JS versions hidden by eq error --- src/gleam_stdlib.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/gleam_stdlib.js') diff --git a/src/gleam_stdlib.js b/src/gleam_stdlib.js index a60b361..95fb526 100644 --- a/src/gleam_stdlib.js +++ b/src/gleam_stdlib.js @@ -36,8 +36,17 @@ export function parse_float(value) { } } -export function to_string(int) { - return int.toString(); +export function to_string(term) { + return term.toString(); +} + +export function float_to_string(float) { + let string = float.toString(); + if (string.indexOf(".") >= 0) { + return string; + } else { + return string + ".0"; + } } export function int_to_base_string(int, base) { -- cgit v1.2.3