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
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var callBound = require('call-bound');
|
---|
4 |
|
---|
5 | /** @type {undefined | ((thisArg: SharedArrayBuffer) => number)} */
|
---|
6 | var $byteLength = callBound('SharedArrayBuffer.prototype.byteLength', true);
|
---|
7 |
|
---|
8 | /** @type {import('.')} */
|
---|
9 | module.exports = $byteLength
|
---|
10 | ? function isSharedArrayBuffer(obj) {
|
---|
11 | if (!obj || typeof obj !== 'object') {
|
---|
12 | return false;
|
---|
13 | }
|
---|
14 | try {
|
---|
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
|
---|
16 | $byteLength(obj);
|
---|
17 | return true;
|
---|
18 | } catch (e) {
|
---|
19 | return false;
|
---|
20 | }
|
---|
21 | }
|
---|
22 | : function isSharedArrayBuffer(_obj) { // eslint-disable-line no-unused-vars
|
---|
23 | return false;
|
---|
24 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.