JSBool JS_ValueToObject()

Description

This function extracts a function argument from a jsval structure, converts it to an object (if possible), and passes the converted value back to the caller. If the object is an array, use JS_GetArrayLength() and JS_GetElement() to read its contents.

Arguments

JSContext *cx, jsval v, JSObject **op

  • The cx argument is the opaque JSContext pointer that passes to the JavaScript function.
  • The v argument is the jsval structure from which the object is to be extracted.
  • The op argument is a pointer to a JSObject pointer. This function stores the converted value in *op.

Returns

A Boolean value: JS_TRUE indicates success; JS_FALSE indicates failure.