mirror of
https://github.com/napi-rs/napi-rs.git
synced 2025-12-08 19:56:07 +00:00
fix(napi): TypedArray is not ArrayBuffer in Deno (#2314)
This commit is contained in:
parent
383b5d023c
commit
161758393f
@ -129,6 +129,11 @@ impl<'x, 'de, 'env> serde::de::Deserializer<'x> for &'de mut De<'env> {
|
||||
return visitor.visit_byte_buf(
|
||||
unsafe { BufferSlice::from_napi_value(self.0.env, self.0.value)? }.to_vec(),
|
||||
);
|
||||
} else if js_object.is_typedarray()? {
|
||||
return visitor.visit_byte_buf(unsafe {
|
||||
let u8_slice: &[u8] = FromNapiValue::from_napi_value(self.0.env, self.0.value)?;
|
||||
u8_slice.to_vec()
|
||||
});
|
||||
} else if js_object.is_arraybuffer()? {
|
||||
let array_buf =
|
||||
unsafe { JsArrayBuffer::from_napi_value(self.0.env, self.0.value)?.into_value()? };
|
||||
|
||||
@ -610,7 +610,7 @@ test('create object from Property', (t) => {
|
||||
})
|
||||
|
||||
test('global', (t) => {
|
||||
t.is(getGlobal(), global)
|
||||
t.is(getGlobal(), typeof global === 'undefined' ? globalThis : global)
|
||||
})
|
||||
|
||||
test('get undefined', (t) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user