napi_has_property


napi_status napi_has_property(napi_env env,
                              napi_value object,
                              napi_value key,
                              bool* result); 
  • [in] env:调用 Node-API 调用的环境。

    ¥[in] env: The environment that the Node-API call is invoked under.

  • [in] object:要查询的对象。

    ¥[in] object: The object to query.

  • [in] key:要检查其存在的属性的名称。

    ¥[in] key: The name of the property whose existence to check.

  • [out] result:该属性是否存在于对象上。

    ¥[out] result: Whether the property exists on the object or not.

如果 API 成功,则返回 napi_ok

¥Returns napi_ok if the API succeeded.

此 API 检查传入的 Object 是否具有命名属性。

¥This API checks if the Object passed in has the named property.