package ezjs_min

  1. Overview
  2. Docs

Source file bigInt.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
open Js

class type bigInt = object
  method toLocaleString : js_string t optdef -> _ t optdef -> js_string t meth
  method toString : js_string t meth
  method valueOf : bigInt t meth
end

type nonrec t = bigInt t

let bigInt : (Unsafe.any -> t) = Unsafe.pure_js_expr "BigInt"

let of_string s = bigInt (Unsafe.inject @@ string s)
let of_int (i : int) = bigInt (Unsafe.inject @@ i)
let of_int64 (i : int64) = of_string (Int64.to_string i)
let of_native (i : nativeint) = of_string (Nativeint.to_string i)
let of_float f = bigInt (Unsafe.inject @@ number_of_float f)

let to_locale_string ?fmt ?options (n : t) =
  to_string (n##toLocaleString (optdef string fmt) (Optdef.option options))
let to_string (n : t) = to_string n##toString
OCaml

Innovation. Community. Security.