You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

21 lines
438 B

'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;
}
};