backport
Version:
A CLI tool that automates the process of backporting commits
15 lines • 833 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.removeLinesBreaksInConflictingFiles = exports.replaceStringAndLinebreaks = void 0;
function replaceStringAndLinebreaks({ haystack, stringBefore, stringAfter, }) {
const regex = stringBefore.split('').join('\\s?');
return haystack.replace(new RegExp(regex, 'g'), stringAfter);
}
exports.replaceStringAndLinebreaks = replaceStringAndLinebreaks;
function removeLinesBreaksInConflictingFiles(str) {
return str.replace(/(Conflicting files:[\s\S]*?)(\n\nPress ENTER when the conflicts are resolved and files are staged)/g, (match, start, end) => {
return start.replace(/\n/g, '') + end;
});
}
exports.removeLinesBreaksInConflictingFiles = removeLinesBreaksInConflictingFiles;
//# sourceMappingURL=replaceStringAndLinebreaks.js.map