source: imaps-frontend/node_modules/es-abstract/2021/WeakRefDeref.js@ d565449

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: 573 bytes
Line 
1'use strict';
2
3var callBound = require('call-bind/callBound');
4
5var $TypeError = require('es-errors/type');
6var $deref = callBound('WeakRef.prototype.deref', true);
7
8var isWeakRef = require('is-weakref');
9
10var AddToKeptObjects = require('./AddToKeptObjects');
11
12// https://262.ecma-international.org/12.0/#sec-weakrefderef
13
14module.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.