Skip to content

Commit

Permalink
Support for unknown values
Browse files Browse the repository at this point in the history
  • Loading branch information
stereobooster committed Jan 2, 2018
1 parent 388c9db commit 72414b0
Show file tree
Hide file tree
Showing 3 changed files with 320 additions and 306 deletions.
20 changes: 11 additions & 9 deletions webpage/scripts/parse_readme.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,18 @@ const parseLinks = linkText => {
return result;
};

const rows = cells
.map(x => {
const result = {};
header.forEach((key, i) => (result[key] = x[i]));
const rows = cells.map(x => {
return header.reduce((result, key, i) => {
if (key === "Package") {
result[key] = parseLinks(x[i]);
} else if (key === "Version") {
result[key] = x[i];
} else {
result[key] = x[i] === "✓";
}
return result;
})
.map(x => {
x.Package = parseLinks(x.Package);
return x;
});
}, {});
});

const json = {
headers: header,
Expand Down
14 changes: 13 additions & 1 deletion webpage/src/components/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ const join = (array, separator) =>
}
}, []);

const symbol = value => {
if (value === true) {
return '✓';
} else if (value === false) {
return '';
} else {
return '?';
}
};

const CellTd = options => {
const { header, value } = options;
if (header === "Package") {
Expand All @@ -18,8 +28,10 @@ const CellTd = options => {
</a>
));
return <td>{join(links, " + ")}</td>;
} else {
} else if (header === "Version") {
return <td>{value}</td>;
} else {
return <td>{symbol(value)}</td>;
}
};

Expand Down
Loading

0 comments on commit 72414b0

Please sign in to comment.