main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
438 bytes
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var callBound = require('call-bind/callBound');
|
---|
| 4 |
|
---|
| 5 | var $deref = callBound('WeakRef.prototype.deref', true);
|
---|
| 6 |
|
---|
| 7 | module.exports = typeof WeakRef === 'undefined'
|
---|
| 8 | ? function isWeakRef(value) { // eslint-disable-line no-unused-vars
|
---|
| 9 | return false;
|
---|
| 10 | }
|
---|
| 11 | : function isWeakRef(value) {
|
---|
| 12 | if (!value || typeof value !== 'object') {
|
---|
| 13 | return false;
|
---|
| 14 | }
|
---|
| 15 | try {
|
---|
| 16 | $deref(value);
|
---|
| 17 | return true;
|
---|
| 18 | } catch (e) {
|
---|
| 19 | return false;
|
---|
| 20 | }
|
---|
| 21 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.