napi_get_property_names


napi_status napi_get_property_names(napi_env env,
                                    napi_value object,
                                    napi_value* result); 
  • [in] env:调用 Node-API 时所处的环境。
  • [in] 对象:要从中获取属性的对象。
  • [out] result:一个 napi_value,表示一个 JavaScript 值的数组,这些值表示对象的属性名。该 API 可以使用 napi_get_array_lengthnapi_get_element 来遍历 result

如果 API 成功,则返回 napi_ok

【Returns napi_ok if the API succeeded.】

此 API 返回 object 的可枚举属性名称,结果为字符串数组。object 中键为符号的属性将不会被包含在内。

【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.】