conv
native moduleParsing and value conversion. import "conv". parse_ follow (value, err); to_ are infallible (runtime error on unsupported input).
conv.parse_int(s: string) => (int, string?)conv.parse_float(s: string) => (float, string?)conv.parse_bool(s: string) => (bool, string?)conv.to_bool(v: any) => boolconv.to_int(v) => intconv.to_float(v) => floatconv.to_string(v: any) => stringconv.to_char(v) => charconv.char_code(v) => int
conv.parse_int(s: string) => (int, string?)
Parse a base-10 int.
conv.parse_float(s: string) => (float, string?)
Parse a float.
conv.parse_bool(s: string) => (bool, string?)
Strictly parse "true"/"false".
conv.to_bool(v: any) => bool
Truthiness (nil/false/0/"" are false).
conv.to_int(v) => int
Number/bool/char → int (floats truncate).
conv.to_float(v) => float
Number/bool → float.
conv.to_string(v: any) => string
Any value → string.
conv.to_char(v) => char
Codepoint int, or first char of a string, → char.
conv.char_code(v) => int
Codepoint of a char or first char of a string.