napi_get_property_names
napi_status napi_get_property_names(napi_env env,
napi_value object,
napi_value* result);
-
[in] env
:调用 Node-API 调用的环境。¥
[in] env
: The environment that the Node-API call is invoked under. -
[in] object
:从中检索属性的对象。¥
[in] object
: The object from which to retrieve the properties. -
[out] result
:一个napi_value
,表示一个 JavaScript 值数组,这些值表示对象的属性名称。API 可用于使用napi_get_array_length
和napi_get_element
迭代result
。¥
[out] result
: Anapi_value
representing an array of JavaScript values that represent the property names of the object. The API can be used to iterate overresult
usingnapi_get_array_length
andnapi_get_element
.
如果 API 成功,则返回 napi_ok
。
¥Returns napi_ok
if the API succeeded.
此 API 以字符串数组的形式返回 object
的可枚举属性的名称。key 为符号的 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.