Update checked-in dependencies
This commit is contained in:
parent
1afca056e3
commit
6989ba7bd2
3942 changed files with 55190 additions and 132206 deletions
26
node_modules/es-abstract/2015/SetValueInBuffer.js
generated
vendored
26
node_modules/es-abstract/2015/SetValueInBuffer.js
generated
vendored
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
var $TypeError = require('es-errors/type');
|
||||
var $Uint8Array = GetIntrinsic('%Uint8Array%', true);
|
||||
|
||||
var isInteger = require('../helpers/isInteger');
|
||||
|
||||
|
|
@ -16,20 +17,9 @@ var ToUint8 = require('./ToUint8');
|
|||
var ToUint8Clamp = require('./ToUint8Clamp');
|
||||
|
||||
var isArrayBuffer = require('is-array-buffer');
|
||||
var has = require('has');
|
||||
var hasOwn = require('hasown');
|
||||
|
||||
var table49 = {
|
||||
__proto__: null,
|
||||
Int8: 1,
|
||||
Uint8: 1,
|
||||
Uint8C: 1,
|
||||
Int16: 2,
|
||||
Uint16: 2,
|
||||
Int32: 4,
|
||||
Uint32: 4,
|
||||
Float32: 4,
|
||||
Float64: 8
|
||||
};
|
||||
var tableTAO = require('./tables/typed-array-objects');
|
||||
|
||||
var TypeToAO = {
|
||||
__proto__: null,
|
||||
|
|
@ -59,7 +49,7 @@ module.exports = function SetValueInBuffer(arrayBuffer, byteIndex, type, value)
|
|||
throw new $TypeError('Assertion failed: `byteIndex` must be an integer');
|
||||
}
|
||||
|
||||
if (typeof type !== 'string' || !has(table49, type)) {
|
||||
if (typeof type !== 'string' || !hasOwn(tableTAO.size, '$' + type)) {
|
||||
throw new $TypeError('Assertion failed: `type` must be a Typed Array Element Type');
|
||||
}
|
||||
|
||||
|
|
@ -87,7 +77,7 @@ module.exports = function SetValueInBuffer(arrayBuffer, byteIndex, type, value)
|
|||
|
||||
// 6. Assert: block is not undefined.
|
||||
|
||||
var elementSize = table49[type]; // step 7
|
||||
var elementSize = tableTAO.size['$' + type]; // step 7
|
||||
if (!elementSize) {
|
||||
throw new $TypeError('Assertion failed: `type` must be one of "Int8", "Uint8", "Uint8C", "Int16", "Uint16", "Int32", "Uint32", "Float32", or "Float64"');
|
||||
}
|
||||
|
|
@ -101,7 +91,7 @@ module.exports = function SetValueInBuffer(arrayBuffer, byteIndex, type, value)
|
|||
} else if (type === 'Float64') { // step 2
|
||||
rawBytes = valueToFloat64Bytes(value, isLittleEndian);
|
||||
} else {
|
||||
var n = table49[type]; // step 3.a
|
||||
var n = elementSize; // step 3.a
|
||||
|
||||
var convOp = TypeToAO[type]; // step 3.b
|
||||
|
||||
|
|
@ -111,7 +101,7 @@ module.exports = function SetValueInBuffer(arrayBuffer, byteIndex, type, value)
|
|||
}
|
||||
|
||||
// 12. Store the individual bytes of rawBytes into block, in order, starting at block[byteIndex].
|
||||
var arr = new Uint8Array(arrayBuffer, byteIndex, elementSize);
|
||||
var arr = new $Uint8Array(arrayBuffer, byteIndex, elementSize);
|
||||
forEach(rawBytes, function (rawByte, i) {
|
||||
arr[i] = rawByte;
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue