From dd5a95548f43097e1aea624fc1e1576f4140f897 Mon Sep 17 00:00:00 2001 From: inoas Date: Tue, 7 Jun 2022 18:14:47 +0000 Subject: JavaScript: fix string_builder.reverse, cleanup (#300) --- src/gleam_stdlib.erl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/gleam_stdlib.erl') diff --git a/src/gleam_stdlib.erl b/src/gleam_stdlib.erl index 6fd44ed..320d80b 100644 --- a/src/gleam_stdlib.erl +++ b/src/gleam_stdlib.erl @@ -10,7 +10,7 @@ percent_encode/1, percent_decode/1, regex_check/2, regex_split/2, base_decode64/1, parse_query/1, bit_string_concat/1, size_of_tuple/1, decode_tuple/1, tuple_get/2, classify_dynamic/1, print/1, println/1, - inspect/1]). + inspect/1, float_to_string/1]). %% Taken from OTP's uri_string module -define(DEC2HEX(X), @@ -374,4 +374,7 @@ inspect(Any) when is_function(Any) -> ), ["//fn(", Args, ") { ... }"]; inspect(Any) -> - ["//erl(", io_lib:format("~p", [Any]), ")"]. \ No newline at end of file + ["//erl(", io_lib:format("~p", [Any]), ")"]. + +float_to_string(Float) when is_float(Float) -> + erlang:iolist_to_binary(io_lib_format:fwrite_g(Float)). -- cgit v1.2.3