mirror of
https://github.com/System-End/github-readme-stats.git
synced 2026-04-19 22:15:15 +00:00
Remove several redundant number -> string -> number conversions (#2856)
* Top langs card: remove redundant number -> string -> number conversion * refactor(waka): remove redundant praseInt --------- Co-authored-by: rickstaa <rick.staa@outlook.com>
This commit is contained in:
parent
9a1cbaf062
commit
62080c019c
2 changed files with 4 additions and 4 deletions
|
|
@ -164,14 +164,14 @@ const donutCenterTranslation = (totalLangs) => {
|
|||
* Trim top languages to lang_count while also hiding certain languages.
|
||||
*
|
||||
* @param {Record<string, Lang>} topLangs Top languages.
|
||||
* @param {string} langs_count Number of languages to show.
|
||||
* @param {number} langs_count Number of languages to show.
|
||||
* @param {string[]=} hide Languages to hide.
|
||||
* @returns {{ langs: Lang[], totalLanguageSize: number }} Trimmed top languages and total size.
|
||||
*/
|
||||
const trimTopLanguages = (topLangs, langs_count, hide) => {
|
||||
let langs = Object.values(topLangs);
|
||||
let langsToHide = {};
|
||||
let langsCount = clampValue(parseInt(langs_count), 1, MAXIMUM_LANGS_COUNT);
|
||||
let langsCount = clampValue(langs_count, 1, MAXIMUM_LANGS_COUNT);
|
||||
|
||||
// populate langsToHide map for quick lookup
|
||||
// while filtering out
|
||||
|
|
@ -734,7 +734,7 @@ const renderTopLanguages = (topLangs, options = {}) => {
|
|||
|
||||
const { langs, totalLanguageSize } = trimTopLanguages(
|
||||
topLangs,
|
||||
String(langs_count),
|
||||
langs_count,
|
||||
hide,
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
|
|||
|
||||
const lheight = parseInt(String(line_height), 10);
|
||||
|
||||
const langsCount = clampValue(parseInt(String(langs_count)), 1, langs_count);
|
||||
const langsCount = clampValue(langs_count, 1, langs_count);
|
||||
|
||||
// returns theme based colors with proper overrides and defaults
|
||||
const { titleColor, textColor, iconColor, bgColor, borderColor } =
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue