index.js 454 B

123456789101112131415161718192021
  1. 'use strict';
  2. var callBound = require('call-bind/callBound');
  3. var $byteLength = callBound('SharedArrayBuffer.prototype.byteLength', true);
  4. module.exports = $byteLength
  5. ? function isSharedArrayBuffer(obj) {
  6. if (!obj || typeof obj !== 'object') {
  7. return false;
  8. }
  9. try {
  10. $byteLength(obj);
  11. return true;
  12. } catch (e) {
  13. return false;
  14. }
  15. }
  16. : function isSharedArrayBuffer(obj) { // eslint-disable-line no-unused-vars
  17. return false;
  18. };