mirror of
https://github.com/tiennm99/github-readme-stats.git
synced 2026-09-10 00:17:35 +00:00
refactor: refactor repo card (#1325)
* refactor: refactored repo-card * test: fix tests * test: fixed tests * fix: unprovided description error
This commit is contained in:
+19
-4
@@ -1,6 +1,7 @@
|
||||
const axios = require("axios");
|
||||
const wrap = require("word-wrap");
|
||||
const themes = require("../../themes");
|
||||
const toEmoji = require("emoji-name-map");
|
||||
|
||||
const renderError = (message, secondaryMessage = "") => {
|
||||
return `
|
||||
@@ -88,10 +89,11 @@ function request(data, headers) {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string[]} items
|
||||
* @param {Number} gap
|
||||
* @param {"column" | "row"} direction
|
||||
* @param {object} props
|
||||
* @param {string[]} props.items
|
||||
* @param {number} props.gap
|
||||
* @param {number[]} props.sizes
|
||||
* @param {"column" | "row"} props.direction
|
||||
*
|
||||
* @returns {string[]}
|
||||
*
|
||||
@@ -257,6 +259,18 @@ function chunkArray(arr, perChunk) {
|
||||
}, []);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} str
|
||||
* @returns {string}
|
||||
*/
|
||||
function parseEmojis(str) {
|
||||
if (!str) throw new Error("[parseEmoji]: str argument not provided");
|
||||
return str.replace(/:\w+:/gm, (emoji) => {
|
||||
return toEmoji.get(emoji) || "";
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
renderError,
|
||||
kFormatter,
|
||||
@@ -276,4 +290,5 @@ module.exports = {
|
||||
CustomError,
|
||||
lowercaseTrim,
|
||||
chunkArray,
|
||||
parseEmojis,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user