ya-webadb/libraries/dataview-bigint-polyfill
2023-12-04 17:10:43 +08:00
..
src chore: update dependencies 2023-07-07 18:30:13 +08:00
.eslintrc.cjs chore: integrate ESLint 2022-12-22 01:42:24 +08:00
.npmignore chore: integrate ESLint 2022-12-22 01:42:24 +08:00
CHANGELOG.json chore: bump versions 2023-08-25 22:07:52 +08:00
CHANGELOG.md chore: bump versions 2023-08-25 22:07:52 +08:00
LICENSE chore: update license year 2023-01-13 02:02:31 +08:00
package.json chore: update dependencies 2023-12-04 17:10:43 +08:00
README.md feat(struct): include polyfill for bigint types 2022-02-02 18:14:47 +08:00
tsconfig.build.json chore: integrate ESLint 2022-12-22 01:42:24 +08:00
tsconfig.json chore: integrate ESLint 2022-12-22 01:42:24 +08:00

@yume-chan/dataview-bigint-polyfill

Polyfill for DataView#getBigInt64, DataView#getBigUint64, DataView#setBigInt64 and DataView#setBigUint64.

Requires native BigInt support.

Flavors

It ships with 3 flavors:

Pure: provide alternative implementations.

import { getBigInt64, getBigUint64, setBigInt64, setBigUint64 } from '@yume-chan/dataview-bigint-polyfill';

getBigInt64(dataView, byteOffset, littleEndian);
getBigUint64(dataView, byteOffset, littleEndian);
setBigInt64(dataView, byteOffset, value, littleEndian);
setBigUint64(dataView, byteOffset, value, littleEndian);

Fallback: use native implementations if available.

import { getBigInt64, getBigUint64, setBigInt64, setBigUint64 } from '@yume-chan/dataview-bigint-polyfill/esm/fallback';

getBigInt64(dataView, byteOffset, littleEndian);
getBigUint64(dataView, byteOffset, littleEndian);
setBigInt64(dataView, byteOffset, value, littleEndian);
setBigUint64(dataView, byteOffset, value, littleEndian);

Polyfill: patch DataView.prototype when native support is not available.

import '@yume-chan/dataview-bigint-polyfill/esm/polyfill.js';

dataView.getBigInt64(byteOffset, littleEndian);
dataView.getBigUint64(byteOffset, littleEndian);
dataView.setBigInt64(byteOffset, value, littleEndian);
dataView.setBigUint64(byteOffset, value, littleEndian);