feat: added ability to set custom cache

This commit is contained in:
anuraghazra
2020-07-20 21:43:51 +05:30
parent dd2c7ed278
commit fdf445d734
5 changed files with 134 additions and 34 deletions

View File

@ -75,7 +75,7 @@ const renderRepoCard = (repo, options = {}) => {
`;
const svgForks =
totalForks > 0 &&
forkCount > 0 &&
`
<svg class="icon" y="-12" viewBox="0 0 16 16" version="1.1" width="16" height="16">
${icons.fork}

View File

@ -44,6 +44,10 @@ function parseBoolean(value) {
}
}
function clampValue(number, min, max) {
return Math.max(min, Math.min(number, max));
}
function fallbackColor(color, fallbackColor) {
return (isValidHexColor(color) && `#${color}`) || fallbackColor;
}
@ -112,6 +116,12 @@ function getCardColors({
return { titleColor, iconColor, textColor, bgColor };
}
const CONSTANTS = {
THIRTY_MINUTES: 1800,
TWO_HOURS: 7200,
ONE_DAY: 86400,
};
module.exports = {
renderError,
kFormatter,
@ -122,4 +132,6 @@ module.exports = {
fallbackColor,
FlexLayout,
getCardColors,
clampValue,
CONSTANTS,
};