Bump eslint-plugin-import to avoid vulnerability in dependency
This commit is contained in:
parent
10695e6a20
commit
ed9506bbaf
1660 changed files with 67726 additions and 27926 deletions
30
node_modules/es-abstract/2022/IsDetachedBuffer.js
generated
vendored
Normal file
30
node_modules/es-abstract/2022/IsDetachedBuffer.js
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var callBound = require('call-bind/callBound');
|
||||
|
||||
var $byteLength = callBound('%ArrayBuffer.prototype.byteLength%', true)
|
||||
|| function byteLength(ab) { return ab.byteLength; }; // in node < 0.11, byteLength is an own nonconfigurable property
|
||||
|
||||
var isArrayBuffer = require('is-array-buffer');
|
||||
|
||||
var availableTypedArrays = require('available-typed-arrays')();
|
||||
|
||||
// https://262.ecma-international.org/6.0/#sec-isdetachedbuffer
|
||||
|
||||
module.exports = function IsDetachedBuffer(arrayBuffer) {
|
||||
if (!isArrayBuffer(arrayBuffer)) {
|
||||
throw new $TypeError('Assertion failed: `arrayBuffer` must be an Object with an [[ArrayBufferData]] internal slot');
|
||||
}
|
||||
if ($byteLength(arrayBuffer) === 0) {
|
||||
try {
|
||||
new global[availableTypedArrays[0]](arrayBuffer); // eslint-disable-line no-new
|
||||
} catch (error) {
|
||||
return error.name === 'TypeError';
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue