JSVAL IS OBJECT
From MDC
Determine whether a given jsval is an object.
Contents |
[edit] Syntax
JSVAL_IS_OBJECT(v)
[edit] Description
JSVAL_IS_OBJECT(v) returns true if v is either an object or JSVAL_NULL. This indicates that it is safe to call JSVAL_TO_OBJECT(v) to convert v to type JSObject *. Be sure to check for JSVAL_NULL separately if necessary.
JSVAL_IS_OBJECT(v) returns false if v is any other type of value: a boolean, number, string, or JSVAL_VOID.
The result of JSVAL_IS_OBJECT(v) is a C/C++ boolean value, not a boolean jsval.
[edit] Example
The following code snippet illustrates how a JavaScript variable, MyItem, is conditionally tested in an if statement to see if it is an object.
if (JSVAL_IS_OBJECT(MyItem)) {
. . .
}
[edit] See Also
LXR ID Search for JSVAL_IS_OBJECT
JSVAL_IS_BOOLEAN, JSVAL_IS_DOUBLE, JSVAL_IS_INT, JSVAL_IS_NULL, JSVAL_IS_NUMBER, JSVAL_IS_PRIMITIVE, JSVAL_IS_STRING, JSVAL_IS_VOID