index.js 481 B

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