fn jsval_to_primitive(
cx: JSContext,
global: &GlobalScope,
chunk: HandleValue<'_>,
rval: MutableHandleValue<'_>,
can_gc: CanGc,
) -> Fallible<()>
Expand description
Converts a JS value to primitive type so that it can be used with
ToString
.
Set rval
to chunk
if chunk
is a primitive JS value. Otherwise, convert
chunk
into a primitive JS value and then set rval
to the converted
primitive. This follows the ToString
procedure with the exception that it
does not convert the value to string.
See below for the ToString
procedure in spec:
https://tc39.es/ecma262/multipage/abstract-operations.html#sec-tostring