napi_get_value_bigint_uint64


napi_status napi_get_value_bigint_uint64(napi_env env,
                                        napi_value value,
                                        uint64_t* result,
                                        bool* lossless); 
  • [in] env:调用 API 的环境。

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

  • [in] valuenapi_value 代表 JavaScript BigInt

    ¥[in] value: napi_value representing JavaScript BigInt.

  • [out] result:给定的 JavaScript BigInt 的 C uint64_t 基础类型等价物。

    ¥[out] result: C uint64_t primitive equivalent of the given JavaScript BigInt.

  • [out] lossless:指示 BigInt 值是否已无损转换。

    ¥[out] lossless: Indicates whether the BigInt value was converted losslessly.

如果 API 成功,则返回 napi_ok。如果传入非 BigInt,则返回 napi_bigint_expected

¥Returns napi_ok if the API succeeded. If a non-BigInt is passed in it returns napi_bigint_expected.

此 API 返回给定 JavaScript BigInt 的 C uint64_t 基础类型等价物。如果需要,它将截断该值,将 lossless 设置为 false

¥This API returns the C uint64_t primitive equivalent of the given JavaScript BigInt. If needed it will truncate the value, setting lossless to false.