Skip to content

Commit

Permalink
refactor: Move condition check after possible premature returns
Browse files Browse the repository at this point in the history
  • Loading branch information
RSeidelsohn committed Apr 12, 2023
1 parent d907eac commit 8540df0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ const recursivelyCollectAllDependencies = (options) => {
let clarification = options.clarifications?.[currentPackageNameAndVersion];
let passedClarificationCheck = clarification?.checksum ? false : true;

if (json.private) {
moduleInfo.private = true;
}

// If we have processed this currentPackageNameAndVersion already, just return the data object.
// This was added so that we don't recurse forever if there was a circular
// dependency in the dependency tree.
Expand All @@ -60,6 +56,10 @@ const recursivelyCollectAllDependencies = (options) => {
return data;
}

if (json.private) {
moduleInfo.private = true;
}

data[currentPackageNameAndVersion] = moduleInfo;

// Include property in output unless custom format has set property to false.
Expand Down

0 comments on commit 8540df0

Please sign in to comment.