| Server IP : 159.203.156.69 / Your IP : 216.73.216.37 Web Server : nginx/1.24.0 System : Linux main-ubuntu 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/tanviranik.com/node_modules/get-symbol-description/ |
Upload File : |
'use strict';
var GetIntrinsic = require('get-intrinsic');
var callBound = require('call-bound');
var $SyntaxError = require('es-errors/syntax');
var getGlobalSymbolDescription = GetIntrinsic('%Symbol.keyFor%', true);
/** @type {undefined | ((thisArg: symbol | Symbol) => symbol)} */
var thisSymbolValue = callBound('%Symbol.prototype.valueOf%', true);
/** @type {undefined | ((thisArg: symbol | Symbol) => string)} */
var symToStr = callBound('Symbol.prototype.toString', true);
/** @type {(thisArg: string, start?: number, end?: number) => string} */
var $strSlice = callBound('String.prototype.slice');
var getInferredName = require('./getInferredName');
/** @type {import('.')} */
/* eslint-disable consistent-return */
module.exports = callBound('%Symbol.prototype.description%', true) || function getSymbolDescription(symbol) {
if (!thisSymbolValue) {
throw new $SyntaxError('Symbols are not supported in this environment');
}
// will throw if not a symbol primitive or wrapper object
var sym = thisSymbolValue(symbol);
if (getInferredName) {
var name = getInferredName(sym);
if (name === '') {
return;
}
return name.slice(1, -1); // name.slice('['.length, -']'.length);
}
var desc;
if (getGlobalSymbolDescription) {
desc = getGlobalSymbolDescription(sym);
if (typeof desc === 'string') {
return desc;
}
}
// eslint-disable-next-line no-extra-parens
desc = $strSlice(/** @type {NonNullable<typeof symToStr>} */ (symToStr)(sym), 7, -1); // str.slice('Symbol('.length, -')'.length);
if (desc) {
return desc;
}
};