|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
564 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | var callBound = require('call-bound');
|
|---|
| 4 |
|
|---|
| 5 | var $TypeError = require('es-errors/type');
|
|---|
| 6 | var $deref = callBound('WeakRef.prototype.deref', true);
|
|---|
| 7 |
|
|---|
| 8 | var isWeakRef = require('is-weakref');
|
|---|
| 9 |
|
|---|
| 10 | var AddToKeptObjects = require('./AddToKeptObjects');
|
|---|
| 11 |
|
|---|
| 12 | // https://262.ecma-international.org/12.0/#sec-weakrefderef
|
|---|
| 13 |
|
|---|
| 14 | module.exports = function WeakRefDeref(weakRef) {
|
|---|
| 15 | if (!isWeakRef(weakRef)) {
|
|---|
| 16 | throw new $TypeError('Assertion failed: `weakRef` must be a WeakRef');
|
|---|
| 17 | }
|
|---|
| 18 | var target = $deref(weakRef);
|
|---|
| 19 | if (target) {
|
|---|
| 20 | AddToKeptObjects(target);
|
|---|
| 21 | }
|
|---|
| 22 | return target;
|
|---|
| 23 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.