source: frontend/node_modules/is-weakref/index.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 599 bytes
RevLine 
[9af201e]1'use strict';
2
3var callBound = require('call-bound');
4
5// eslint-disable-next-line no-extra-parens
6var $deref = /** @type {<T extends WeakKey>(thisArg: WeakRef<T>) => T | undefined} */ (callBound('WeakRef.prototype.deref', true));
7
8/** @type {import('.')} */
9module.exports = typeof WeakRef === 'undefined'
10 ? function isWeakRef(_value) { // eslint-disable-line no-unused-vars
11 return false;
12 }
13 : function isWeakRef(value) {
14 if (!value || typeof value !== 'object') {
15 return false;
16 }
17 try {
18 // @ts-expect-error
19 $deref(value);
20 return true;
21 } catch (e) {
22 return false;
23 }
24 };
Note: See TracBrowser for help on using the repository browser.