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

Function maybePrintImportAssertions

lib/printer.ts:2878–2900  ·  view source on GitHub ↗
(
  path: any,
  options: any,
  print: any,
)

Source from the content-addressed store, hash-verified

2876}
2877
2878function maybePrintImportAssertions(
2879 path: any,
2880 options: any,
2881 print: any,
2882): Lines {
2883 const n = path.getValue();
2884 if (n.assertions && n.assertions.length > 0) {
2885 const parts: (string | Lines)[] = [" assert {"];
2886 const printed = path.map(print, "assertions");
2887 const flat = fromString(", ").join(printed);
2888 if (flat.length > 1 || flat.getLineLength(1) > options.wrapColumn) {
2889 parts.push(
2890 "\n",
2891 fromString(",\n").join(printed).indent(options.tabWidth),
2892 "\n}",
2893 );
2894 } else {
2895 parts.push(" ", flat, " }");
2896 }
2897 return concat(parts);
2898 }
2899 return fromString("");
2900}
2901
2902function printExportDeclaration(path: any, options: any, print: any) {
2903 const decl = path.getValue();

Callers 2

genericPrintNoParensFunction · 0.85
printExportDeclarationFunction · 0.85

Calls 7

fromStringFunction · 0.90
concatFunction · 0.90
getValueMethod · 0.80
mapMethod · 0.80
joinMethod · 0.80
getLineLengthMethod · 0.80
indentMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…