JavaScript-1.5 Reference

JS_ValueToBoolean Function

Summary

Converts a JS value to a JS Boolean.

Syntax

JSBool JS_ValueToBoolean(JSContext *cx, jsval v,
    JSBool *bp);
NameTypeDescription
cxJSContext *Pointer to a JS context from which to derive runtime information.
vjsvalThe JS value to convert.
bpJSBool *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 unsuccessful, JS_ValueToBoolean returns JS_FALSE.

See Also

Groups [ Function ]
Documents [ LXR ID Search ]
Entries [ JS_ConvertArguments | JS_ConvertValue | JS_GetTypeName | JS_TypeOfValue | JS_ValueToFunction | JS_ValueToInt32 | JS_ValueToNumber | JS_ValueToObject | JS_ValueToString ]

This page was generated by APIDOC