New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@yume-chan/dataview-bigint-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yume-chan/dataview-bigint-polyfill - npm Package Compare versions

Comparing version 0.0.17 to 0.0.18

tsconfig.build.json

6

CHANGELOG.json

@@ -5,2 +5,8 @@ {

{
"version": "0.0.18",
"tag": "@yume-chan/dataview-bigint-polyfill_v0.0.18",
"date": "Wed, 25 Jan 2023 21:33:49 GMT",
"comments": {}
},
{
"version": "0.0.17",

@@ -7,0 +13,0 @@ "tag": "@yume-chan/dataview-bigint-polyfill_v0.0.17",

7

CHANGELOG.md
# Change Log - @yume-chan/dataview-bigint-polyfill
This log was last generated on Tue, 18 Oct 2022 09:32:30 GMT and should not be manually modified.
This log was last generated on Wed, 25 Jan 2023 21:33:49 GMT and should not be manually modified.
## 0.0.18
Wed, 25 Jan 2023 21:33:49 GMT
_Version update only_
## 0.0.17

@@ -6,0 +11,0 @@ Tue, 18 Oct 2022 09:32:30 GMT

18

esm/pure.js

@@ -5,6 +5,8 @@ const BigInt32 = BigInt(32);

const bigEndianMask = Number(!littleEndian);
return (BigInt(dataView.getInt32(byteOffset, littleEndian) * bigEndianMask +
dataView.getInt32(byteOffset + 4, littleEndian) * littleEndianMask) << BigInt32) |
return ((BigInt(dataView.getInt32(byteOffset, littleEndian) * bigEndianMask +
dataView.getInt32(byteOffset + 4, littleEndian) *
littleEndianMask) <<
BigInt32) |
BigInt(dataView.getUint32(byteOffset, littleEndian) * littleEndianMask +
dataView.getUint32(byteOffset + 4, littleEndian) * bigEndianMask);
dataView.getUint32(byteOffset + 4, littleEndian) * bigEndianMask));
}

@@ -19,9 +21,8 @@ export function getBigUint64(dataView, byteOffset, littleEndian) {

// https://jsbench.me/p8kyhg1eqv/1
return (BigInt(a * bigEndianMask + b * littleEndianMask) << BigInt32) |
BigInt(a * littleEndianMask + b * bigEndianMask);
return ((BigInt(a * bigEndianMask + b * littleEndianMask) << BigInt32) |
BigInt(a * littleEndianMask + b * bigEndianMask));
}
;
export function setBigInt64(dataView, byteOffset, value, littleEndian) {
const hi = Number(value >> BigInt32);
const lo = Number(value & BigInt(0xFFFFFFFF));
const lo = Number(value & BigInt(0xffffffff));
if (littleEndian) {

@@ -38,3 +39,3 @@ dataView.setInt32(byteOffset + 4, hi, littleEndian);

const hi = Number(value >> BigInt32);
const lo = Number(value & BigInt(0xFFFFFFFF));
const lo = Number(value & BigInt(0xffffffff));
if (littleEndian) {

@@ -49,3 +50,2 @@ dataView.setUint32(byteOffset + 4, hi, littleEndian);

}
;
//# sourceMappingURL=pure.js.map
{
"name": "@yume-chan/dataview-bigint-polyfill",
"version": "0.0.17",
"version": "0.0.18",
"description": "Polyfill for `DataView#getBigInt64`, `DataView#getBigUint64`, `DataView#setBigInt64` and `DataView#setBigUint64`",

@@ -32,14 +32,17 @@ "keywords": [

"dependencies": {
"tslib": "^2.4.0"
"tslib": "^2.4.1"
},
"devDependencies": {
"jest": "^28.1.2",
"typescript": "^4.7.4",
"@yume-chan/ts-package-builder": "^1.0.0"
"@yume-chan/eslint-config": "^1.0.0",
"@yume-chan/tsconfig": "^1.0.0",
"eslint": "^8.31.0",
"jest": "^29.3.1",
"typescript": "^4.9.4"
},
"scripts": {
"build": "build-ts-package",
"build:watch": "build-ts-package --incremental",
"//test": "jest --coverage"
"build": "tsc -b tsconfig.build.json",
"build:watch": "tsc -b tsconfig.build.json",
"//test": "jest --coverage",
"lint": "eslint src/**/*.ts --fix"
}
}
const BigInt32 = BigInt(32);
export function getBigInt64(dataView: DataView, byteOffset: number, littleEndian: boolean | undefined): bigint {
export function getBigInt64(
dataView: DataView,
byteOffset: number,
littleEndian: boolean | undefined
): bigint {
const littleEndianMask = Number(!!littleEndian);

@@ -8,13 +12,20 @@ const bigEndianMask = Number(!littleEndian);

return (
BigInt(
(BigInt(
dataView.getInt32(byteOffset, littleEndian) * bigEndianMask +
dataView.getInt32(byteOffset + 4, littleEndian) * littleEndianMask
) << BigInt32) |
dataView.getInt32(byteOffset + 4, littleEndian) *
littleEndianMask
) <<
BigInt32) |
BigInt(
dataView.getUint32(byteOffset, littleEndian) * littleEndianMask +
dataView.getUint32(byteOffset + 4, littleEndian) * bigEndianMask
);
dataView.getUint32(byteOffset + 4, littleEndian) * bigEndianMask
)
);
}
export function getBigUint64(dataView: DataView, byteOffset: number, littleEndian: boolean | undefined): bigint {
export function getBigUint64(
dataView: DataView,
byteOffset: number,
littleEndian: boolean | undefined
): bigint {
const a = dataView.getUint32(byteOffset, littleEndian);

@@ -29,9 +40,16 @@ const b = dataView.getUint32(byteOffset + 4, littleEndian);

// https://jsbench.me/p8kyhg1eqv/1
return (BigInt(a * bigEndianMask + b * littleEndianMask) << BigInt32) |
BigInt(a * littleEndianMask + b * bigEndianMask);
};
return (
(BigInt(a * bigEndianMask + b * littleEndianMask) << BigInt32) |
BigInt(a * littleEndianMask + b * bigEndianMask)
);
}
export function setBigInt64(dataView: DataView, byteOffset: number, value: bigint, littleEndian: boolean | undefined) {
export function setBigInt64(
dataView: DataView,
byteOffset: number,
value: bigint,
littleEndian: boolean | undefined
) {
const hi = Number(value >> BigInt32);
const lo = Number(value & BigInt(0xFFFFFFFF));
const lo = Number(value & BigInt(0xffffffff));

@@ -47,5 +65,10 @@ if (littleEndian) {

export function setBigUint64(dataView: DataView, byteOffset: number, value: bigint, littleEndian: boolean | undefined) {
export function setBigUint64(
dataView: DataView,
byteOffset: number,
value: bigint,
littleEndian: boolean | undefined
) {
const hi = Number(value >> BigInt32);
const lo = Number(value & BigInt(0xFFFFFFFF));
const lo = Number(value & BigInt(0xffffffff));

@@ -59,2 +82,2 @@ if (littleEndian) {

}
};
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc