Object::get_own_property_names should act like Object.getOwnPropertyNames does in JS, but there was no n-api function available to do exactly that. Instead, we're using napi_get_property_names, which acts more like for (var key in object), including properties from the prototype and the like.
Right now, we're doing this load of work to paper over that: https://github.com/goto-bus-stop/neon/blob/9b338f9ed0a8dcb781566b61bc06b67f07ca23a1/crates/neon-runtime/src/napi/object.rs#L17-L84
But it's still not accurate.
There is an napi_get_all_property_names API that would allow implementing Object::get_own_property_names correctly, and with a lot less code to boot. At the time of the PR, it was still in the process of being backported. Once it is available in all release lines (Node.js 10/12/13/14), we can switch to napi_get_all_property_names.
Object::get_own_property_namesshould act likeObject.getOwnPropertyNamesdoes in JS, but there was no n-api function available to do exactly that. Instead, we're usingnapi_get_property_names, which acts more likefor (var key in object), including properties from the prototype and the like.Right now, we're doing this load of work to paper over that: https://github.com/goto-bus-stop/neon/blob/9b338f9ed0a8dcb781566b61bc06b67f07ca23a1/crates/neon-runtime/src/napi/object.rs#L17-L84
But it's still not accurate.
There is an
napi_get_all_property_namesAPI that would allow implementingObject::get_own_property_namescorrectly, and with a lot less code to boot. At the time of the PR, it was still in the process of being backported. Once it is available in all release lines (Node.js 10/12/13/14), we can switch tonapi_get_all_property_names.