simple-git
Version:
Simple GIT interface for node.js
29 lines • 965 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("../utils");
function parseGetRemotes(text) {
const remotes = {};
forEach(text, ([name]) => remotes[name] = { name });
return Object.values(remotes);
}
exports.parseGetRemotes = parseGetRemotes;
function parseGetRemotesVerbose(text) {
const remotes = {};
forEach(text, ([name, url, purpose]) => {
if (!remotes.hasOwnProperty(name)) {
remotes[name] = {
name: name,
refs: { fetch: '', push: '' },
};
}
if (purpose && url) {
remotes[name].refs[purpose.replace(/[^a-z]/g, '')] = url;
}
});
return Object.values(remotes);
}
exports.parseGetRemotesVerbose = parseGetRemotesVerbose;
function forEach(text, handler) {
utils_1.forEachLineWithContent(text, (line) => handler(line.split(/\s+/)));
}
//# sourceMappingURL=GetRemoteSummary.js.map