StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics https://doi.org/10.1109/TVCG.2020.3030352
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.
 
 
 
 
StackGenVis/frontend/node_modules/git-repo-name/index.js

41 lines
943 B

'use strict';
var url = require('url');
var path = require('path');
var utils = require('./utils');
module.exports = function(cwd, cb) {
if (typeof cwd === 'function') {
cb = cwd;
cwd = '.';
}
var gitPath = path.resolve(utils.cwd(cwd), '.git/config');
utils.origin(gitPath, function(err, giturl) {
if (err) {
cb(err);
return;
}
if(!giturl) {
cb(new Error('cannot find ".git/config"'));
return;
}
var parsed = url.parse(giturl);
var segments = parsed.pathname.split(path.sep);
cb(null, utils.filename(segments.pop()));
});
};
module.exports.sync = function(cwd) {
var gitPath = path.resolve(utils.cwd(cwd), '.git/config');
var giturl = utils.origin.sync(gitPath);
if (!giturl) {
throw new Error('cannot find ".git/config"');
}
var parsed = url.parse(giturl);
var segments = parsed.pathname.split(path.sep);
return utils.filename(segments.pop());
};