Function mozjs_sys::jsapi::JS::GetFirstArgumentAsTypeHint

source ·
pub unsafe extern "C" fn GetFirstArgumentAsTypeHint(
    cx: *mut JSContext,
    args: *const CallArgs,
    result: *mut JSType,
) -> bool
Expand description

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

This can be useful in implementing a @@toPrimitive method.