package quickjs
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=594fac60b9273af7e1903f0689efa353121309d8de911376f91966c32cd3ab7f
sha512=68beb126919a214fa9e46d84566c97e6ff3667c6c4478f352f1145e5bf1888b2a5eaca9855f39d734b2e9dc5bc0c7650f45679d177d546a2b0ba53dced5f2d1f
doc/quickjs/Quickjs/Global/index.html
Module Quickjs.GlobalSource
JavaScript Global object functions
This module contains global functions from the JavaScript specification like parseFloat and parseInt.
type parse_options = {radix : int;(*0 = auto-detect, 2-36 = fixed radix
*)int_only : bool;(*Only accept integers (no dot, no exponent)
*)accept_bin_oct : bool;(*Accept 0b and 0o prefixes when radix=0
*)accept_legacy_octal : bool;(*Accept 0777 style (Annex B) when radix=0
*)accept_underscores : bool;(*Accept 1_000_000 as digit separator
*)
}Parsing options for string-to-number conversion
Default options: radix 10, no special parsing
JavaScript-compatible options: auto-detect radix, accept 0b/0o prefixes
parse_float ?options str parses string str as a floating-point number. Returns None if parsing fails. Equivalent to JavaScript's parseFloat().
parse_float_partial ?options str parses the beginning of string str as a floating-point number, returning the parsed value and remaining string. Returns None if no valid number is found at the start.
parse_int ?radix str parses string str as an integer. radix specifies the base (2-36), or 0 for auto-detect. Default is 10. Returns None if parsing fails or radix is invalid. Equivalent to JavaScript's parseInt().