diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 77b3d3b4a4a46f..f3f22157a05d06 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -1659,6 +1659,66 @@ However, for better performance, it's better for the caller to make sure that the `napi_value` in question is of the JavaScript type expected by the API. ### Enum types +#### napi_key_collection_mode + + +> Stability: 1 - Experimental + +```C +typedef enum { + napi_key_include_prototypes, + napi_key_own_only +} napi_key_collection_mode; +``` + +Describes the `Keys/Properties` filter enums: + +`napi_key_collection_mode` limits the range of collected properties. + +`napi_key_own_only` limits the collected properties to the given +object only. `napi_key_include_prototypes` will include all keys +of the objects's prototype chain as well. + +#### napi_key_filter + + +> Stability: 1 - Experimental + +```C +typedef enum { + napi_key_all_properties = 0, + napi_key_writable = 1, + napi_key_enumerable = 1 << 1, + napi_key_configurable = 1 << 2, + napi_key_skip_strings = 1 << 3, + napi_key_skip_symbols = 1 << 4 +} napi_key_filter; +``` + +Property filter bits. They can be or'ed to build a composite filter. + +#### napi_key_conversion + + +> Stability: 1 - Experimental + +```C +typedef enum { + napi_key_keep_numbers, + napi_key_numbers_to_strings +} napi_key_conversion; +``` + +`napi_key_numbers_to_strings` will convert integer indices to +strings. `napi_key_keep_numbers` will return numbers for integer +indices. + #### napi_valuetype ```C @@ -3535,6 +3595,37 @@ This API returns the names of the enumerable properties of `object` as an array of strings. The properties of `object` whose key is a symbol will not be included. +#### napi_get_all_property_names + + +> Stability: 1 - Experimental + +```C +napi_get_all_property_names(napi_env env, + napi_value object, + napi_key_collection_mode key_mode, + napi_key_filter key_filter, + napi_key_conversion key_conversion, + napi_value* result); +``` + +* `[in] env`: The environment that the N-API call is invoked under. +* `[in] object`: The object from which to retrieve the properties. +* `[in] key_mode`: Whether to retrieve prototype properties as well. +* `[in] key_filter`: Which properties to retrieve +(enumerable/readable/writable). +* `[in] key_conversion`: Whether to convert numbered property keys to strings. +* `[out] result`: A `napi_value` representing an array of JavaScript values +that represent the property names of the object. [`napi_get_array_length`][] and +[`napi_get_element`][] can be used to iterate over `result`. + +Returns `napi_ok` if the API succeeded. + +This API returns an array containing the names of the available properties +of this object. + #### napi_set_property