Open-source IoT Platform - Device management, data collection, processing and visualization.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

17 lines
580 B

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.addCommentBefore = addCommentBefore;
exports.default = addComment;
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);
}
function addComment(str, indent, comment) {
return !comment ? str : comment.indexOf('\n') === -1 ? "".concat(str, " #").concat(comment) : "".concat(str, "\n") + comment.replace(/^/gm, "".concat(indent || '', "#"));
}