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
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var callBound = require('call-bind/callBound');
|
---|
4 |
|
---|
5 | /** @type {undefined | ((value: ThisParameterType<typeof FinalizationRegistry.prototype.register>, ...args: Parameters<typeof FinalizationRegistry.prototype.register>) => ReturnType<typeof FinalizationRegistry.prototype.register>)} */
|
---|
6 | var $register = callBound('FinalizationRegistry.prototype.register', true);
|
---|
7 |
|
---|
8 | /** @type {import('.')} */
|
---|
9 | module.exports = $register
|
---|
10 | ? function isFinalizationRegistry(value) {
|
---|
11 | if (!value || typeof value !== 'object') {
|
---|
12 | return false;
|
---|
13 | }
|
---|
14 | try {
|
---|
15 | // @ts-expect-error TS can't figure out that it's always truthy here
|
---|
16 | $register(value, {}, null);
|
---|
17 | return true;
|
---|
18 | } catch (e) {
|
---|
19 | return false;
|
---|
20 | }
|
---|
21 | }
|
---|
22 | // @ts-ignore unused var
|
---|
23 | : function isFinalizationRegistry(value) { // eslint-disable-line no-unused-vars
|
---|
24 | return false;
|
---|
25 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.