aboutsummaryrefslogtreecommitdiff
path: root/src/gleam_stdlib.mjs
diff options
context:
space:
mode:
authorMcKayla Washburn <mckayla@hey.com>2022-12-04 13:56:19 -0800
committerLouis Pilfold <louis@lpil.uk>2022-12-05 11:42:27 +0000
commitcd1e91cf3fc5d82c01fec0dac2b8899b95b2d4b9 (patch)
treea36275ff06419332fa8ed98d6943a96a076ac7c4 /src/gleam_stdlib.mjs
parenteaae8f4737559aa9397b993ba052c6e4f89b629c (diff)
downloadgleam_stdlib-cd1e91cf3fc5d82c01fec0dac2b8899b95b2d4b9.tar.gz
gleam_stdlib-cd1e91cf3fc5d82c01fec0dac2b8899b95b2d4b9.zip
tweak names
Diffstat (limited to 'src/gleam_stdlib.mjs')
-rw-r--r--src/gleam_stdlib.mjs20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/gleam_stdlib.mjs b/src/gleam_stdlib.mjs
index 8a2d88f..a3e6c13 100644
--- a/src/gleam_stdlib.mjs
+++ b/src/gleam_stdlib.mjs
@@ -95,7 +95,7 @@ export function string_length(string) {
export function graphemes(string) {
return List.fromArray(
- Array.from(graphemes_iterator(string)).map(((item) => item.segment ))
+ Array.from(graphemes_iterator(string)).map((item) => item.segment)
);
}
@@ -199,12 +199,12 @@ export function bit_string_concat(bit_strings) {
return toBitString(bit_strings.toArray().map((b) => b.buffer));
}
-export function log(term) {
+export function console_log(term) {
console.log(term);
}
-export function debug(term) {
- console.log(inspect(term));
+export function console_error(term) {
+ console.error(term);
}
export function crash(message) {
@@ -228,7 +228,7 @@ export function print(string) {
}
}
-export function eprint(string) {
+export function print_error(string) {
if (typeof process === "object") {
process.stderr.write(string); // We can write without a trailing newline
} else {
@@ -236,6 +236,14 @@ export function eprint(string) {
}
}
+export function print_debug(string) {
+ if (typeof process === "object") {
+ process.stderr.write(string + "\n"); // If we're in Node.js, use `stderr`
+ } else {
+ console.log(string); // Otherwise, use `console.log` (so that it doesn't look like an error)
+ }
+}
+
export function ceiling(float) {
return Math.ceil(float);
}
@@ -259,7 +267,7 @@ export function power(base, exponent) {
// the result will essentially be division by zero).
// It can thus be assumed that valid input is passed to the Math.pow
// function and a NaN or Infinity value will not be produced.
- return Math.pow(base, exponent)
+ return Math.pow(base, exponent);
}
export function random_uniform() {