UNPKG

simple-git

Version:

Simple GIT interface for node.js

27 lines 940 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const utils_1 = require("../utils"); class CleanResponse { constructor(dryRun) { this.dryRun = dryRun; this.paths = []; this.files = []; this.folders = []; } } exports.CleanResponse = CleanResponse; const removalRegexp = /^[a-z]+\s*/i; const dryRunRemovalRegexp = /^[a-z]+\s+[a-z]+\s*/i; const isFolderRegexp = /\/$/; function cleanSummaryParser(dryRun, text) { const summary = new CleanResponse(dryRun); const regexp = dryRun ? dryRunRemovalRegexp : removalRegexp; utils_1.toLinesWithContent(text).forEach(line => { const removed = line.replace(regexp, ''); summary.paths.push(removed); (isFolderRegexp.test(removed) ? summary.folders : summary.files).push(removed); }); return summary; } exports.cleanSummaryParser = cleanSummaryParser; //# sourceMappingURL=CleanSummary.js.map