Skip to content

Commit a39b19b

Browse files
committed
Refactor getVersionFromToolVersionsFile function
- Simplified parameter handling by providing a default value directly in the function signature. - Improved readability by removing unnecessary variable assignment.
1 parent f4e6c94 commit a39b19b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/versions.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,13 @@ function fetchLatestTag(repo) {
106106
);
107107
}
108108

109-
async function getVersionFromToolVersionsFile(toolVersionsPath) {
109+
async function getVersionFromToolVersionsFile(toolVersionsPath = ".tool-versions") {
110110
try {
111-
toolVersionsPath = toolVersionsPath || ".tool-versions";
112111
const toolVersions = await fs.readFile(toolVersionsPath, {
113-
encoding: "utf-8",
112+
encoding: "utf-8"
114113
});
115114
return toolVersions.match(/^scarb ([\w.-]+)/m)?.[1];
116-
} catch (e) {
115+
} catch {
117116
return undefined;
118117
}
119118
}

0 commit comments

Comments
 (0)