mirror of
https://github.com/Sevichecc/Urara-Blog.git
synced 2025-05-07 05:09:13 +08:00
21 lines
438 B
Text
21 lines
438 B
Text
'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;
|
|
}
|
|
};
|