Find the bug in this checker, which promises to catch every dependency path from domain to adapter code.
JavaScript
function forbiddenDependencies(graph, domainModules, adapterModules) {
const violations = [];
for (const domain of domainModules) {
for (const dependency of graph.get(domain) ?? []) {
if (adapterModules.has(dependency)) {
violations.push(`${domain} -> ${dependency}`);
}
}
}
return violations;
}
const graph = new Map([
['order', ['shared-money']],
['shared-money', ['postgres-decimal']],
]);