We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

JS ValueToId

Converts a jsval to type jsid.


JSBool JS_ValueToId(JSContext *cx, jsval v, jsid *idp);
Name Type Description
cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.
v jsval The JS value to convert.
idp jsid * Out parameter. On success, *idp receives the converted jsid.


JS_ValueToId converts a specified jsval, v, to a jsid. If v is an integer, *idp receives an integer jsid. Otherwise, if E4X support is enabled and v is an object, *idp receives an object jsid. Otherwise, *idp receives an interned string jsid based on the value of v. If v is not a string, it is converted to a string as if by calling JS_ValueToString.

On success, JS_ValueToId stores the converted value in *idp and returns JS_TRUE. Otherwise it returns JS_FALSE.

The inverse is JS_IdToValue.

MXR ID Search for JS_ValueToId

Document Tags and Contributors

Last updated by: Jorend,