Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
resolveDep.local = function(patterns, options) {
options = options || {};
options.cwd = options.srcBase = cwd(options.cwd || process.cwd());
patterns = arrayify(arrayify(patterns));
if (!patterns.length) {
return [];
}
// find local matches
return glob.sync(patterns, options).map(function(filepath) {
return lookup(filepath, options.cwd);
});
};
del.promise = function delPromise(patterns, options) {
var opts = extend({cwd: process.cwd()}, options);
var deleted = [];
if (patterns === '' && isCurrentDir(opts.cwd)) {
return Promise.resolve(deleted);
}
return glob.promise(patterns, opts)
.then(function(files) {
// sync is actually faster than async most of the time
files.forEach(function(fp) {
del.sync(fp, opts);
deleted.push(fp);
});
return deleted;
});
};
return Promise.method(function (patterns, opts) {
return glob.sync(patterns, opts);
});
});
app.create('file', opts, function (views, opts) {
return glob.bind(glob);
});
resolve(type) {
const config = this.type(type);
const files = glob.sync(config.patterns, config.options);
const cwd = config.options.cwd;
const res = [];
for (let filename of files) {
const filepath = path.resolve(cwd, filename);
const file = new File({path: filepath, cwd: cwd});
if (typeof config.filter === 'function') {
if (config.filter(file) === false) {
continue;
}
}
res.push(file);
}
return res;
}
function files(cwd, patterns, opts) {
return glob.sync(path.join(cwd, patterns), opts);
}
EuPmc.prototype.summariseMinedTerms = function () {
log.info('Writing mined term summary CSV files to minedterms_summary/')
mkdirp.sync('minedterms_summary')
var termstore = {}
glob.sync(['*/textMinedTerms.json']).forEach(function (termsFile) {
var json = fs.readFileSync(termsFile, 'utf8')
var terms = JSON.parse(json)
terms.semanticTypeList.semanticType.forEach(function (termset) {
if (!termstore[termset.name]) {
termstore[termset.name] = []
}
var rows = termset.tmSummary.map(function (term) {
return [
terms.request.id,
'"' + term.term + '"',
term.count,
term.dbname,
term.dbIdList.dbId.join(';')
]
})
termstore[termset.name] = termstore[termset.name].concat(rows)
function files(base, pattern) {
return glob.sync(toGlob(base, pattern));
}
glob (globs, options) {
return glob.sync(globs, options)
.filter(relativePath => this.shouldInclude(relativePath))
}
globViews(patterns, options) {
patterns = utils.arrayify(patterns);
const opts = Object.assign({ cwd: process.cwd() }, this.options, options);
delete opts.nonull;
for (let i = 0; i < patterns.length; i++) {
const pattern = patterns[i];
const is = isGlob(pattern);
let files = is ? glob.sync(pattern, opts) : [];
if (files.length === 0) {
files = !is ? [pattern] : [];
} else {
files = files.map(f => path.resolve(opts.cwd, f));
}
if (files.length) {
const parent = path.resolve(is ? globParent(pattern) : '.');
const base = path.resolve(opts.cwd, parent);
this.addViews(files, Object.assign({}, options, { base: base }));
}
}
return this.cache;
}