MCPcopy Create free account
hub / github.com/GNOME/gjs / formatSymbol

Function formatSymbol

modules/script/_bootstrap/default.js:147–162  ·  view source on GitHub ↗
(sym)

Source from the content-addressed store, hash-verified

145 }
146
147 function formatSymbol(sym) {
148 // Try to format Symbols in the same way that they would be constructed.
149
150 // First check if this is a global registered symbol
151 const globalKey = Symbol.keyFor(sym);
152 if (globalKey !== undefined)
153 return `Symbol.for("${globalKey}")`;
154
155 const descr = sym.description;
156 // Special-case the 'well-known' (built-in) Symbols
157 if (descr.startsWith('Symbol.'))
158 return descr;
159
160 // Otherwise, it's just a regular symbol
161 return `Symbol("${descr}")`;
162 }
163
164 Object.defineProperties(exports, {
165 ARGV: {

Callers 3

prettyPrintFunction · 0.85
formatPropertyKeyFunction · 0.85
formatObjectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected