array-buffer-is-detached.js 387 B

123456789101112131415
  1. 'use strict';
  2. var uncurryThis = require('../internals/function-uncurry-this');
  3. var arrayBufferByteLength = require('../internals/array-buffer-byte-length');
  4. var slice = uncurryThis(ArrayBuffer.prototype.slice);
  5. module.exports = function (O) {
  6. if (arrayBufferByteLength(O) !== 0) return false;
  7. try {
  8. slice(O, 0, 0);
  9. return false;
  10. } catch (error) {
  11. return true;
  12. }
  13. };