You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The property APIs include napi_get_property_names() for doing what I think is roughly equivalent to a for-in loop to collect all enumerable property keys, and napi_get_all_property_names() for collecting all property keys whether enumerable or not.
But AFAICT there's no API for doing the equivalent of Object.getOwnPropertyNames(). This one, especially in combination with napi_get_prototype, actually makes for a more powerful primitive, since you can incrementally crawl the prototype chain looking at the properties of one object at a time.
I imagine this one wouldn't be too hard to implement, and I suspect the design is fairly straightforward too: naming conventions strongly suggest napi_get_own_property_names by analogy to the corresponding JS API, and the behavior would simply be the same as 15.2.3.4.
The text was updated successfully, but these errors were encountered:
The property APIs include
napi_get_property_names()
for doing what I think is roughly equivalent to afor
-in
loop to collect all enumerable property keys, andnapi_get_all_property_names()
for collecting all property keys whether enumerable or not.But AFAICT there's no API for doing the equivalent of
Object.getOwnPropertyNames()
. This one, especially in combination withnapi_get_prototype
, actually makes for a more powerful primitive, since you can incrementally crawl the prototype chain looking at the properties of one object at a time.I imagine this one wouldn't be too hard to implement, and I suspect the design is fairly straightforward too: naming conventions strongly suggest
napi_get_own_property_names
by analogy to the corresponding JS API, and the behavior would simply be the same as 15.2.3.4.The text was updated successfully, but these errors were encountered: