MCPcopy Create free account
hub / github.com/prettier/prettier / printGroupId

Function printGroupId

src/document/debug.js:204–221  ·  view source on GitHub ↗
(id)

Source from the content-addressed store, hash-verified

202 }
203
204 function printGroupId(id) {
205 if (typeof id !== "symbol") {
206 return JSON.stringify(String(id));
207 }
208
209 if (id in printedSymbols) {
210 return printedSymbols[id];
211 }
212
213 const prefix = id.description || "symbol";
214 for (let counter = 0; ; counter++) {
215 const key = prefix + (counter > 0 ? ` #${counter}` : "");
216 if (!usedKeysForSymbols.has(key)) {
217 usedKeysForSymbols.add(key);
218 return (printedSymbols[id] = `Symbol.for(${JSON.stringify(key)})`);
219 }
220 }
221 }
222}
223
224export { printDocToDebug };

Callers 1

printDocFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected