Testing and conversion functions between a JS ID and a JS string.

Syntax

bool
JSID_IS_STRING(jsid id);

JSString *
JSID_TO_STRING(jsid id);

jsid
INTERNED_STRING_TO_JSID(JSContext *cx, JSString *str); // Added in SpiderMonkey 38

JSFlatString *
JSID_TO_FLAT_STRING(jsid id); // Added in SpiderMonkey 17
Name Type Description
cx JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.
id jsid The property identifier to test or convert.
str JSString * An interned string to convert to an id.

Description

JSID_IS_STRING tests whether a specified JS ID, id, is a string, and returns true if it's a string.

JSID_TO_STRING converts a specified JS ID, id to a JSString *.

INTERNED_STRING_TO_JSID converts a specified interned string, str to a jsid.

JSID_TO_FLAT_STRING converts a specified JS ID, id to a JSFlatString *.

See Also