napi_has_own_property


napi_status napi_has_own_property(napi_env env,
                                  napi_value object,
                                  napi_value key,
                                  bool* result); 
  • [in] env:调用 Node-API 时所处的环境。
  • [in] object:要查询的对象。
  • [in] key:要检查其存在性的自身属性的名称。
  • [out] result:对象上是否存在自身属性。

如果 API 成功,则返回 napi_ok

【Returns napi_ok if the API succeeded.】

此 API 用于检查传入的 Object 是否具有指定的自身属性。key 必须是 stringsymbol,否则会抛出错误。Node-API 不会在数据类型之间进行任何转换。

【This API checks if the Object passed in has the named own property. key must be a string or a symbol, or an error will be thrown. Node-API will not perform any conversion between data types.】