Skip to content

Commit abbca12

Browse files
author
Robert Jackson
authored
Merge pull request #248 from davecombs/master
fixed return value of getVersionFromJSONFile
2 parents b6104ff + bb0bb19 commit abbca12

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/dependency-version-checker.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ function getVersionFromJSONFile(filePath) {
1111
try {
1212
// Use the require cache to avoid file I/O after first call on a given path.
1313
let pkg = require(filePath);
14-
return pkg.version || null;
14+
15+
// Note: the callers rely on the fact that pkg.version may be undefined, so
16+
// we must not be "smart" about setting the value to null here to stop any
17+
// repeated calls for the same path.
18+
return pkg.version;
1519
} catch (err) {
1620
// file doesn't exist or is not a file or is not parseable.
1721
return null;

0 commit comments

Comments
 (0)