Function mozjs::jsapi::GetArrayLength

source ·
pub unsafe extern "C" fn GetArrayLength(
    cx: *mut JSContext,
    obj: Handle<*mut JSObject>,
    lengthp: *mut u32
) -> bool
Expand description

Store |*lengthp = ToLength(obj.length)| and return true on success, else return false.

If the length does not fit in |uint32_t|, an exception is reported and false is returned.

|ToLength| converts its input to an integer usable to index an array-like object.

If |obj| is an Array, this overall operation is the same as getting |obj.length|.