Contents

JSValueToUInt64(_:_:_:)

Declaration

func JSValueToUInt64(_ ctx: JSContextRef, _ value: JSValueRef, _ exception: UnsafeMutablePointer<JSValueRef?>?) -> UInt64

Parameters

  • ctx:

    The execution context to use.

  • value:

    The JSValue to convert.

  • exception:

    A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.

Return Value

A uint64_t with the result of conversion, or 0 if an exception is thrown. Since 0 is valid value, exception must be checked after the call.

Discussion

Converts a JSValue to an unsigned 64-bit integer and returns the resulting integer.

The JSValue is converted to an integer according to the rules specified by the JavaScript language. If the value is a BigInt, then the JSValue is truncated to a uint64_t.