feat: hide specific languages in "Top languages" card (#150)

* add new query param to hide specific languages in top languages card

* [top-langs] add function to clean out the provided lang name

* [top-langs] rename 'hide_lang' => 'hide', refactor logic for parsing the list of provided languages to hide

* [top-langs] take list of languages to hide, as a json array

* chore: minor changes

* docs: added docs for hide lang

Co-authored-by: anuraghazra <hazru.anurag@gmail.com>
This commit is contained in:
Arjun Mahishi
2020-07-23 19:47:04 +05:30
committed by GitHub
parent 17c33cd322
commit c2adcfd6fe
6 changed files with 67 additions and 37 deletions

View File

@ -2,6 +2,7 @@ require("dotenv").config();
const {
renderError,
parseBoolean,
parseJSON,
clampValue,
CONSTANTS,
} = require("../src/utils");
@ -44,7 +45,7 @@ module.exports = async (req, res) => {
res.send(
renderStatsCard(stats, {
hide: JSON.parse(hide || "[]"),
hide: parseJSON(hide),
show_icons: parseBoolean(show_icons),
hide_title: parseBoolean(hide_title),
hide_border: parseBoolean(hide_border),

View File

@ -3,6 +3,7 @@ const {
renderError,
clampValue,
parseBoolean,
parseJSON,
CONSTANTS,
} = require("../src/utils");
const fetchTopLanguages = require("../src/fetchTopLanguages");
@ -11,7 +12,7 @@ const renderTopLanguages = require("../src/renderTopLanguages");
module.exports = async (req, res) => {
const {
username,
hide_langs_below,
hide,
hide_title,
card_width,
title_color,
@ -43,7 +44,7 @@ module.exports = async (req, res) => {
theme,
hide_title: parseBoolean(hide_title),
card_width: parseInt(card_width, 10),
hide_langs_below: parseFloat(hide_langs_below, 10),
hide: parseJSON(hide),
title_color,
text_color,
bg_color,