Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function findAll() {
return jp.dataDirs({ withSysPrefix: true }).then(dirs => {
return Promise.all(dirs
// get kernel infos for each directory and ignore errors
.map(dir => getKernelInfos(path.join(dir, 'kernels')).catch(() => {}))
).then(extractKernelResources)
});
}
function find(kernelName) {
return jp.dataDirs({ withSysPrefix: true }).then(dirs => {
const kernelInfos = dirs.map(dir => ({
name: kernelName,
resourceDir: path.join(dir, 'kernels', kernelName),
}))
return extractKernelResources(kernelInfos);
}).then(kernelResource => kernelResource[kernelName])
}