Entry: JS_ValueToBoolean (Function)
Summary: Converts a JS value to a JS Boolean.
Syntax:
JSBool JS_ValueToBoolean(JSContext *cx, jsval v,
JSBool *bp);
Argument Type Description
cx JSContext * Pointer to a JS context from which to derive runtime information.
v jsval The JS value to convert.
bp JSBool * Pointer to the JS value that contains the converted Boolean when the function returns.
Description:
JS_ValueToBoolean converts a specified JS value, v, to a JS Boolean. The actual conversion is performed by the object's convert operation. Converting any JS value to a Boolean always succeeds, except when the JS value is a JSVAL_OBJECT that does not support its own conversion routine.
The converted value is stored in the JSBool pointed to by bp. If the conversion is successful, JS_ValueToBoolean returns JS_TRUE. If the value to convert is an empty string, or conversion is unsuccesful, JS_ValueToBoolean returns JS_FALSE.
See also:
|
|
|