JSVAL TO BOOLEAN
From MDC
Converts a JavaScript boolean value to a C integer, either 0 or 1, without any type checking or error handling.
[edit] Syntax
JSVAL_TO_BOOLEAN(v)
[edit] Description
The value of v must be either JSVAL_TRUE or JSVAL_FALSE (these are jsvals). Otherwise the result is undefined. To check whether a jsval is a boolean, use JSVAL_IS_BOOLEAN.
The result is JS_TRUE or JS_FALSE respectively. These are constants of type JSBool, which is an integer type, the SpiderMonkey version of bool. JS_FALSE is 0; JS_TRUE is 1.
If the jsval you have is not necessarily a JavaScript boolean but might be a number, string, null, or something else, use JS_ValueToBoolean instead.
To convert a JSBool to jsval, use BOOLEAN_TO_JSVAL.