Convert first argument of @@toPrimitive method to JSType.


JS::GetFirstArgumentAsTypeHint(JSContext* cx, CallArgs args, JSType *result);
Name Type Description
cx JSContext * The context in which to define functions. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.
fs CallArgs The arguments of the function call.
behavior JSType * Receives the result of conversion. See below.


JS::GetFirstArgumentAsTypeHint converts first argument of @@toPrimitive method to JSType.

If args.get(0) is one of the strings "string", "number", or "default", set *result to JSTYPE_STRING, JSTYPE_NUMBER, or JSTYPE_VOID accordingly and return true. Otherwise, return false with a TypeError pending.

See Also

Document Tags and Contributors

 Contributors to this page: rolfedh, arai
 Last updated by: rolfedh,