main
Last change
on this file since 0c6b92a was 0c6b92a, checked in by stefan toskovski <stefantoska84@…>, 5 weeks ago |
Pred finalna verzija
|
-
Property mode
set to
100644
|
File size:
835 bytes
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var callBound = require('call-bind/callBound');
|
---|
| 4 |
|
---|
[0c6b92a] | 5 | /** @type {undefined | ((value: ThisParameterType<typeof FinalizationRegistry.prototype.register>, ...args: Parameters<typeof FinalizationRegistry.prototype.register>) => ReturnType<typeof FinalizationRegistry.prototype.register>)} */
|
---|
[d565449] | 6 | var $register = callBound('FinalizationRegistry.prototype.register', true);
|
---|
| 7 |
|
---|
[0c6b92a] | 8 | /** @type {import('.')} */
|
---|
[d565449] | 9 | module.exports = $register
|
---|
| 10 | ? function isFinalizationRegistry(value) {
|
---|
| 11 | if (!value || typeof value !== 'object') {
|
---|
| 12 | return false;
|
---|
| 13 | }
|
---|
| 14 | try {
|
---|
[0c6b92a] | 15 | // @ts-expect-error TS can't figure out that it's always truthy here
|
---|
| 16 | $register(value, {}, null);
|
---|
[d565449] | 17 | return true;
|
---|
| 18 | } catch (e) {
|
---|
| 19 | return false;
|
---|
| 20 | }
|
---|
| 21 | }
|
---|
[0c6b92a] | 22 | // @ts-ignore unused var
|
---|
[d565449] | 23 | : function isFinalizationRegistry(value) { // eslint-disable-line no-unused-vars
|
---|
| 24 | return false;
|
---|
| 25 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.