Swap-Aggregator-Subgraph/node_modules/yaml/browser/dist/addComment.js
2022-07-03 07:27:35 +05:30

8 lines
437 B
JavaScript

export function addCommentBefore(str, indent, comment) {
if (!comment) return str;
var cc = comment.replace(/[\s\S]^/gm, "$&".concat(indent, "#"));
return "#".concat(cc, "\n").concat(indent).concat(str);
}
export function addComment(str, indent, comment) {
return !comment ? str : comment.indexOf('\n') === -1 ? "".concat(str, " #").concat(comment) : "".concat(str, "\n") + comment.replace(/^/gm, "".concat(indent || '', "#"));
}