Skip to content

napi_get_own_property_names #698

@dherman

Description

@dherman

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions