@metaplex-foundation/umi-serializer-data-view
Advanced tools
Comparing version 0.7.2 to 0.7.3
{ | ||
"name": "@metaplex-foundation/umi-serializer-data-view", | ||
"version": "0.7.2", | ||
"version": "0.7.3", | ||
"description": "A serializer implementation relying on the native DataView API", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -13,2 +13,3 @@ /* eslint-disable no-bitwise */ | ||
} from './errors'; | ||
import { UInt8ArrayToBuffer } from './helpers'; | ||
@@ -53,3 +54,5 @@ const assertRange = ( | ||
assertEnoughBytes('u8', bytes.slice(offset), 1); | ||
const view = new DataView(bytes.slice(offset, offset + 1).buffer); | ||
const view = new DataView( | ||
UInt8ArrayToBuffer(bytes.slice(offset, offset + 1)) | ||
); | ||
return [view.getUint8(0), offset + 1]; | ||
@@ -74,3 +77,5 @@ }, | ||
assertEnoughBytes('i8', bytes.slice(offset), 1); | ||
const view = new DataView(bytes.slice(offset, offset + 1).buffer); | ||
const view = new DataView( | ||
UInt8ArrayToBuffer(bytes.slice(offset, offset + 1)) | ||
); | ||
return [view.getInt8(0), offset + 1]; | ||
@@ -97,3 +102,5 @@ }, | ||
assertEnoughBytes('u16', bytes.slice(offset), 2); | ||
const view = new DataView(bytes.slice(offset, offset + 2).buffer); | ||
const view = new DataView( | ||
UInt8ArrayToBuffer(bytes.slice(offset, offset + 2)) | ||
); | ||
return [view.getUint16(0, littleEndian), offset + 2]; | ||
@@ -122,3 +129,5 @@ }, | ||
assertEnoughBytes('i16', bytes.slice(offset), 2); | ||
const view = new DataView(bytes.slice(offset, offset + 2).buffer); | ||
const view = new DataView( | ||
UInt8ArrayToBuffer(bytes.slice(offset, offset + 2)) | ||
); | ||
return [view.getInt16(0, littleEndian), offset + 2]; | ||
@@ -146,3 +155,5 @@ }, | ||
assertEnoughBytes('u32', bytes.slice(offset), 4); | ||
const view = new DataView(bytes.slice(offset, offset + 4).buffer); | ||
const view = new DataView( | ||
UInt8ArrayToBuffer(bytes.slice(offset, offset + 4)) | ||
); | ||
return [view.getUint32(0, littleEndian), offset + 4]; | ||
@@ -171,3 +182,5 @@ }, | ||
assertEnoughBytes('i32', bytes.slice(offset), 4); | ||
const view = new DataView(bytes.slice(offset, offset + 4).buffer); | ||
const view = new DataView( | ||
UInt8ArrayToBuffer(bytes.slice(offset, offset + 4)) | ||
); | ||
return [view.getInt32(0, littleEndian), offset + 4]; | ||
@@ -196,3 +209,5 @@ }, | ||
assertEnoughBytes('u64', bytes.slice(offset), 8); | ||
const view = new DataView(bytes.slice(offset, offset + 8).buffer); | ||
const view = new DataView( | ||
UInt8ArrayToBuffer(bytes.slice(offset, offset + 8)) | ||
); | ||
return [view.getBigUint64(0, littleEndian), offset + 8]; | ||
@@ -222,3 +237,5 @@ }, | ||
assertEnoughBytes('i64', bytes.slice(offset), 8); | ||
const view = new DataView(bytes.slice(offset, offset + 8).buffer); | ||
const view = new DataView( | ||
UInt8ArrayToBuffer(bytes.slice(offset, offset + 8)) | ||
); | ||
return [view.getBigInt64(0, littleEndian), offset + 8]; | ||
@@ -253,3 +270,5 @@ }, | ||
assertEnoughBytes('u128', bytes.slice(offset), 16); | ||
const view = new DataView(bytes.slice(offset, offset + 16).buffer); | ||
const view = new DataView( | ||
UInt8ArrayToBuffer(bytes.slice(offset, offset + 16)) | ||
); | ||
const leftOffset = littleEndian ? 8 : 0; | ||
@@ -288,3 +307,5 @@ const rightOffset = littleEndian ? 0 : 8; | ||
assertEnoughBytes('i128', bytes.slice(offset), 16); | ||
const view = new DataView(bytes.slice(offset, offset + 16).buffer); | ||
const view = new DataView( | ||
UInt8ArrayToBuffer(bytes.slice(offset, offset + 16)) | ||
); | ||
const leftOffset = littleEndian ? 8 : 0; | ||
@@ -315,3 +336,5 @@ const rightOffset = littleEndian ? 0 : 8; | ||
assertEnoughBytes('f32', bytes.slice(offset), 4); | ||
const view = new DataView(bytes.slice(offset, offset + 4).buffer); | ||
const view = new DataView( | ||
UInt8ArrayToBuffer(bytes.slice(offset, offset + 4)) | ||
); | ||
return [view.getFloat32(0, littleEndian), offset + 4]; | ||
@@ -338,3 +361,5 @@ }, | ||
assertEnoughBytes('f64', bytes.slice(offset), 8); | ||
const view = new DataView(bytes.slice(offset, offset + 8).buffer); | ||
const view = new DataView( | ||
UInt8ArrayToBuffer(bytes.slice(offset, offset + 8)) | ||
); | ||
return [view.getFloat64(0, littleEndian), offset + 8]; | ||
@@ -341,0 +366,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
292980
42
2980