napi_coerce_to_bool
napi_status napi_coerce_to_bool(napi_env env,
napi_value value,
napi_value* result)
-
[in] env
:调用 API 的环境。¥
[in] env
: The environment that the API is invoked under. -
[in] value
:要强制转换的 JavaScript 值。¥
[in] value
: The JavaScript value to coerce. -
[out] result
:napi_value
代表强制的 JavaScriptBoolean
。¥
[out] result
:napi_value
representing the coerced JavaScriptBoolean
.
如果 API 成功,则返回 napi_ok
。
¥Returns napi_ok
if the API succeeded.
该 API 实现了 ECMAScript 语言规范的 第 7.1.2 节 中定义的抽象操作 ToBoolean()
。
¥This API implements the abstract operation ToBoolean()
as defined in
Section 7.1.2 of the ECMAScript Language Specification.