@eagleoutice/flowr-dev
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
16 lines • 794 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeBlock = codeBlock;
exports.jsonWithLimit = jsonWithLimit;
const json_1 = require("../../util/json");
function codeBlock(language, code) {
return `\n\`\`\`${language}\n${code?.trim() ?? ''}\n\`\`\`\n`;
}
function jsonWithLimit(object, maxLength = 5_000, tooLongText = '_As the code is pretty long, we inhibit pretty printing and syntax highlighting (JSON):_') {
const prettyPrinted = JSON.stringify(object, json_1.jsonReplacer, 2);
return `
${prettyPrinted.length > maxLength ? tooLongText : ''}
${codeBlock(prettyPrinted.length > maxLength ? 'text' : 'json', prettyPrinted.length > 5_000 ? JSON.stringify(object, json_1.jsonReplacer) : prettyPrinted)}
`;
}
//# sourceMappingURL=doc-code.js.map