source: imaps-frontend/node_modules/is-shared-array-buffer/index.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 671 bytes
RevLine 
[d565449]1'use strict';
2
[79a0317]3var callBound = require('call-bound');
[d565449]4
[79a0317]5/** @type {undefined | ((thisArg: SharedArrayBuffer) => number)} */
[d565449]6var $byteLength = callBound('SharedArrayBuffer.prototype.byteLength', true);
7
8/** @type {import('.')} */
9module.exports = $byteLength
10 ? function isSharedArrayBuffer(obj) {
11 if (!obj || typeof obj !== 'object') {
12 return false;
13 }
14 try {
[79a0317]15 // @ts-expect-error TS can't figure out this closed-over variable is non-nullable, and it's fine that `obj` might not be a SAB
[d565449]16 $byteLength(obj);
17 return true;
18 } catch (e) {
19 return false;
20 }
21 }
[79a0317]22 : function isSharedArrayBuffer(_obj) { // eslint-disable-line no-unused-vars
[d565449]23 return false;
24 };
Note: See TracBrowser for help on using the repository browser.