napi_check_object_type_tag


napi_status napi_check_object_type_tag(napi_env env,
                                       napi_value js_object,
                                       const napi_type_tag* type_tag,
                                       bool* result); 
  • [in] env:API 被调用时所处的环境。
  • [in] js_object:要检查类型标签的 JavaScript 对象或 外部
  • [in] type_tag:用于与对象上找到的任何标签进行比较的标签。
  • [out] result:给定的类型标签是否与对象上的类型标签匹配。如果在对象上没有找到类型标签,则也会返回 false

如果 API 成功,则返回 napi_ok

🌐 Returns napi_ok if the API succeeded.

将作为 type_tag 提供的指针与 js_object 上可以找到的任何标签进行比较。如果在 js_object 上未找到标签,或者找到的标签与 type_tag 不匹配,则将 result 设置为 false。如果找到的标签与 type_tag 匹配,则将 result 设置为 true

🌐 Compares the pointer given as type_tag with any that can be found on js_object. If no tag is found on js_object or, if a tag is found but it does not match type_tag, then result is set to false. If a tag is found and it matches type_tag, then result is set to true.