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) => {
regex.lastIndex = 0;
const matches = regex.exec(line);
return (
matches && {
depName: matches[1],
currentValue: matches[2],
if (!matches) {
return null;
}
const [, depName, currentValue] = matches;
return {
depName,
currentValue,
lineNumber,
versionScheme: 'pep440',
}
);
};
})
.filter(Boolean);
if (!deps.length) {