Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var packages = map(packageNames, function(f) {
var pkg = cache[f];
var file = base + f + '.json';
if (!pkg) {
try {
pkg = cache[f] = JSON.parse(readFile(base + f + '.json'));
} catch (e) {
throw new Error('[Helper] failed to parse <' + file + '> as JSON: ' + e.message);
}
}
return pkg;
});
return new Moddle(packages);
}