Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const resolveExtTypePath = (path, ext) => {
const exts = extNames[ext];
if (!exts.length) {
throw new Error(`Module '${ orgFn }' not found, as required in '${ fromfile }'`);
}
return deferred.some(exts, fileExt =>
statP(path + fileExt)(
stats => {
if (stats.isFile()) {
path += fileExt;
return true;
}
return false;
},
err => {
if (err.code !== "ENOENT") throw err;
return false;
}
)
)(found => {
if (!found) {
throw new Error(