src,node-api: update napi_is_detached_arraybuffer

This gets `napi_is_detached_arraybuffer(..)` to use the new API,
`ArrayBuffer::WasDetached`, that looks more straightforward.

Signed-off-by: Daeyeon Jeong <daeyeon.dev@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/45538
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
This commit is contained in:
Daeyeon Jeong 2022-11-22 16:14:59 +09:00 committed by GitHub
parent 20b3152e20
commit be049df055
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3254,7 +3254,7 @@ napi_status NAPI_CDECL napi_is_detached_arraybuffer(napi_env env,
v8::Local<v8::Value> value = v8impl::V8LocalValueFromJsValue(arraybuffer);
*result =
value->IsArrayBuffer() && value.As<v8::ArrayBuffer>()->Data() == nullptr;
value->IsArrayBuffer() && value.As<v8::ArrayBuffer>()->WasDetached();
return napi_clear_last_error(env);
}