diff options
Diffstat (limited to 'src/gleam_stdlib.js')
-rw-r--r-- | src/gleam_stdlib.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/gleam_stdlib.js b/src/gleam_stdlib.js index e69de29..960792b 100644 --- a/src/gleam_stdlib.js +++ b/src/gleam_stdlib.js @@ -0,0 +1,19 @@ +export function identity(x) { + return x +} + +export function parse_int(value) { + if (/^[-+]?(\d+)$/.test(value)) { + return { "type": "Ok", "0": Number(value) } + } else { + return { "type": "Error", "0": null } + } +} + +export function int_to_string(int) { + return int.toString() +} + +export function int_to_base_string(int, base) { + return int.toString(base) +}
\ No newline at end of file |