Function mozjs_sys::jsapi::JS_Enumerate

source ·
pub unsafe extern "C" fn JS_Enumerate(
    cx: *mut JSContext,
    obj: Handle<*mut JSObject>,
    props: MutableHandle<IdVector>
) -> bool
Expand description

Get an array of the non-symbol enumerable properties of obj. This function is roughly equivalent to:

var result = [];
for (key in obj) {
    result.push(key);
}
return result;

This is the closest thing we currently have to the ES6 [[Enumerate]] internal method.

The array of ids returned by JS_Enumerate must be rooted to protect its contents from garbage collection. Use JS::RootedJS::IdVector.