aboutsummaryrefslogtreecommitdiff
path: root/src/gleam_stdlib.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/gleam_stdlib.js')
-rw-r--r--src/gleam_stdlib.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gleam_stdlib.js b/src/gleam_stdlib.js
index 68ab895..1e93901 100644
--- a/src/gleam_stdlib.js
+++ b/src/gleam_stdlib.js
@@ -199,3 +199,11 @@ export function bit_string_to_string(bit_string) {
return gleam_error(undefined);
}
}
+
+export function print(string) {
+ if (typeof process === "object") {
+ process.stdout.write(string); // We can write without a trailing newline
+ } else {
+ console.log(string); // We're in a browser. Newlines are mandated
+ }
+}