MCPcopy
hub / github.com/usebruno/bruno / serializeAnnotations

Function serializeAnnotations

packages/bruno-lang/v2/src/utils.js:71–85  ·  view source on GitHub ↗
(annotations)

Source from the content-addressed store, hash-verified

69};
70
71function serializeAnnotations(annotations) {
72 if (!annotations?.length) return '';
73 return (
74 annotations
75 .map((a) => {
76 if (a.value === undefined) return `@${a.name}`;
77 if (a.value.includes('\n')) {
78 return `@${a.name}('''\n${indentString(a.value)}\n''')`;
79 }
80 const quote = a.value.includes('\'') ? '"' : '\'';
81 return `@${a.name}(${quote}${a.value}${quote})`;
82 })
83 .join('\n') + '\n'
84 );
85};
86
87module.exports = {
88 safeParseJson,

Callers 3

jsonToBruFunction · 0.85
jsonToCollectionBruFunction · 0.85
envToJsonFunction · 0.85

Calls 2

indentStringFunction · 0.70
mapMethod · 0.45

Tested by

no test coverage detected