refactor(pip): expand matches logic

This commit is contained in:
Rhys Arkins 2018-06-05 10:26:58 +02:00
parent 775b2979eb
commit c2c50222cc

View file

@ -20,14 +20,16 @@ function extractDependencies(content) {
.map((line, lineNumber) => { .map((line, lineNumber) => {
regex.lastIndex = 0; regex.lastIndex = 0;
const matches = regex.exec(line); const matches = regex.exec(line);
return ( if (!matches) {
matches && { return null;
depName: matches[1], }
currentValue: matches[2], const [, depName, currentValue] = matches;
return {
depName,
currentValue,
lineNumber, lineNumber,
versionScheme: 'pep440', versionScheme: 'pep440',
} };
);
}) })
.filter(Boolean); .filter(Boolean);
if (!deps.length) { if (!deps.length) {