mirror of
https://github.com/Instadapp/Swap-Aggregator-Subgraph.git
synced 2024-07-29 21:57:12 +00:00
14 lines
452 B
JavaScript
14 lines
452 B
JavaScript
"use strict";
|
|
|
|
exports.addCommentBefore = addCommentBefore;
|
|
exports.addComment = addComment;
|
|
|
|
function addCommentBefore(str, indent, comment) {
|
|
if (!comment) return str;
|
|
const cc = comment.replace(/[\s\S]^/gm, `$&${indent}#`);
|
|
return `#${cc}\n${indent}${str}`;
|
|
}
|
|
|
|
function addComment(str, indent, comment) {
|
|
return !comment ? str : comment.indexOf('\n') === -1 ? `${str} #${comment}` : `${str}\n` + comment.replace(/^/gm, `${indent || ''}#`);
|
|
} |