Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const loadedResources = items.reduce((loaded, resourceId) => {
try {
const resource = loadResource(resourceId, type, configurations, true);
loaded.push(resource);
} catch (e) {
const name = isFullPackageName(resourceId, type) ? resourceId : `${type}-${resourceId}`;
if (e.status === ResourceErrorStatus.NotCompatible) {
incompatible.push(name);
} else if (e.status === ResourceErrorStatus.NotFound) {
missing.push(name);
} else {
throw e;
}
}
return loaded;
}, [] as any[]);