MCPcopy
hub / github.com/benjamn/recast / nodeStr

Function nodeStr

lib/printer.ts:3090–3104  ·  view source on GitHub ↗
(str: string, options: any)

Source from the content-addressed store, hash-verified

3088}
3089
3090function nodeStr(str: string, options: any) {
3091 isString.assert(str);
3092 switch (options.quote) {
3093 case "auto": {
3094 const double = jsSafeStringify(str);
3095 const single = swapQuotes(jsSafeStringify(swapQuotes(str)));
3096 return double.length > single.length ? single : double;
3097 }
3098 case "single":
3099 return swapQuotes(jsSafeStringify(swapQuotes(str)));
3100 case "double":
3101 default:
3102 return jsSafeStringify(str);
3103 }
3104}
3105
3106function maybeAddSemicolon(lines: any) {
3107 const eoc = lastNonSpaceCharacter(lines);

Callers 1

genericPrintNoParensFunction · 0.85

Calls 2

jsSafeStringifyFunction · 0.85
swapQuotesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…