frontend/.pnpm-store/v3/files/93/538cb43d7824c548c3cbc099485747a2f9b1b22e744d2a8473f421560f4e5808180f359c2247096efe27d70c07b71882d63d8d948e1afb41431e2b1d116ed1

41 lines
945 B
Plaintext

'use strict';
var GetIntrinsic = require('get-intrinsic');
var $SyntaxError = GetIntrinsic('%SyntaxError%');
var $TypeError = GetIntrinsic('%TypeError%');
var IsIntegralNumber = require('./IsIntegralNumber');
var whichTypedArray = require('which-typed-array');
// https://262.ecma-international.org/13.0/#sec-typedarrayelementsize
var table71 = {
__proto__: null,
$Int8Array: 1,
$Uint8Array: 1,
$Uint8ClampedArray: 1,
$Int16Array: 2,
$Uint16Array: 2,
$Int32Array: 4,
$Uint32Array: 4,
$BigInt64Array: 8,
$BigUint64Array: 8,
$Float32Array: 4,
$Float64Array: 8
};
module.exports = function TypedArrayElementSize(O) {
var type = whichTypedArray(O);
if (type === false) {
throw new $TypeError('Assertion failed: `O` must be a TypedArray');
}
var size = table71['$' + type];
if (!IsIntegralNumber(size) || size < 0) {
throw new $SyntaxError('Assertion failed: Unknown TypedArray type `' + type + '`');
}
return size;
};