mirror of
https://github.com/DavidHDev/vue-bits.git
synced 2026-03-07 14:39:30 -07:00
Add prettier config, format codebase
This commit is contained in:
@@ -5,19 +5,19 @@
|
||||
*/
|
||||
export const getStarsCount = async (repo: string = 'DavidHDev/vue-bits'): Promise<number> => {
|
||||
try {
|
||||
const response = await fetch(`https://api.github.com/repos/${repo}`)
|
||||
const response = await fetch(`https://api.github.com/repos/${repo}`);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`GitHub API error: ${response.status}`)
|
||||
throw new Error(`GitHub API error: ${response.status}`);
|
||||
}
|
||||
|
||||
const data = await response.json()
|
||||
return data.stargazers_count || 0
|
||||
const data = await response.json();
|
||||
return data.stargazers_count || 0;
|
||||
} catch (error) {
|
||||
console.error('Error fetching GitHub stars:', error)
|
||||
throw error
|
||||
console.error('Error fetching GitHub stars:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a label from kebab-case to title case
|
||||
@@ -25,10 +25,10 @@ export const getStarsCount = async (repo: string = 'DavidHDev/vue-bits'): Promis
|
||||
* @returns The decoded label (e.g., "Split Text")
|
||||
*/
|
||||
export const decodeLabel = (label: string): string => {
|
||||
if (!label) return ''
|
||||
if (!label) return '';
|
||||
|
||||
return label
|
||||
.split('-')
|
||||
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
||||
.join(' ')
|
||||
}
|
||||
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
||||
.join(' ');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user