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.
43 lines
766 B
43 lines
766 B
const fs = require('fs');
|
|
const exists = require('fs-exists-sync');
|
|
|
|
function isEmpty(path, fn, callback) {
|
|
if (arguments.length === 2) {
|
|
callback = fn;
|
|
fn = null;
|
|
}
|
|
|
|
if (!exists(path)) {
|
|
callback(null, false);
|
|
return;
|
|
}
|
|
|
|
fs.readdir(path, function(err, files) {
|
|
if (err) {
|
|
callback(err);
|
|
return;
|
|
}
|
|
|
|
if (typeof fn === 'function') {
|
|
files = files.filter(fn);
|
|
}
|
|
|
|
callback(null, files.length === 0);
|
|
});
|
|
}
|
|
|
|
isEmpty.sync = function(path, fn) {
|
|
if (!exists(path)) {
|
|
return false;
|
|
}
|
|
try {
|
|
var files = fs.readdirSync(path);
|
|
if (typeof fn === 'function') {
|
|
files = files.filter(fn);
|
|
}
|
|
return files.length === 0;
|
|
} catch (err) {}
|
|
return false;
|
|
};
|
|
|
|
module.exports = isEmpty;
|
|
|