If allegedNumber passes the isNat test, then return it as a bigint.
Otherwise throw an appropriate error.
If allegedNum is neither a bigint nor a number, Nat throws a TypeError.
Otherwise, if it is not a safely
representable
non-negative integer, Nat throws a RangeError.
Otherwise, it is converted to a bigint if necessary and returned.
If
allegedNumber
passes theisNat
test, then return it as a bigint. Otherwise throw an appropriate error.If
allegedNum
is neither a bigint nor a number,Nat
throws aTypeError
. Otherwise, if it is not a safely representable non-negative integer,Nat
throws aRangeError
. Otherwise, it is converted to a bigint if necessary and returned.