Pibd-21_Alekseev_I.S._Inter.../IP/node_modules/is-weakref/index.js
VanyaAlekseev ccc3e790bb lab2
2023-12-03 16:59:28 +04:00

22 lines
438 B
JavaScript

'use strict';
var callBound = require('call-bind/callBound');
var $deref = callBound('WeakRef.prototype.deref', true);
module.exports = typeof WeakRef === 'undefined'
? function isWeakRef(value) { // eslint-disable-line no-unused-vars
return false;
}
: function isWeakRef(value) {
if (!value || typeof value !== 'object') {
return false;
}
try {
$deref(value);
return true;
} catch (e) {
return false;
}
};