Check nodes explicitly to be null instead of relying on fallback

Cleaner, don't check twice and increases cov
This commit is contained in:
Sandro Jäckel 2024-10-14 14:31:59 +02:00
parent 9146253594
commit f0c2dceddc
No known key found for this signature in database
GPG key ID: 3AF5A43A3EECC2E5

View file

@ -24,14 +24,14 @@ export function extractPackageFile(
const flakeLock = flakeLockParsed.data; const flakeLock = flakeLockParsed.data;
for (const depName of Object.keys(flakeLock.nodes ?? {})) {
// the root input is a magic string for the entrypoint and only references other flake inputs
if (depName === 'root') {
continue;
}
// skip if there are no inputs // skip if there are no inputs
if (flakeLock.nodes === undefined) { if (flakeLock.nodes === undefined) {
return null;
}
for (const depName of Object.keys(flakeLock.nodes)) {
// the root input is a magic string for the entrypoint and only references other flake inputs
if (depName === 'root') {
continue; continue;
} }