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:
457 bytes
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
[79a0317] | 3 | var callBound = require('call-bound');
|
---|
[d565449] | 4 |
|
---|
| 5 | var $deref = callBound('WeakRef.prototype.deref', true);
|
---|
| 6 |
|
---|
[79a0317] | 7 | /** @type {import('.')} */
|
---|
[d565449] | 8 | module.exports = typeof WeakRef === 'undefined'
|
---|
[79a0317] | 9 | ? function isWeakRef(_value) { // eslint-disable-line no-unused-vars
|
---|
[d565449] | 10 | return false;
|
---|
| 11 | }
|
---|
| 12 | : function isWeakRef(value) {
|
---|
| 13 | if (!value || typeof value !== 'object') {
|
---|
| 14 | return false;
|
---|
| 15 | }
|
---|
| 16 | try {
|
---|
| 17 | $deref(value);
|
---|
| 18 | return true;
|
---|
| 19 | } catch (e) {
|
---|
| 20 | return false;
|
---|
| 21 | }
|
---|
| 22 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.