Move json format functions to formatUtil (#834)

This commit is contained in:
Chenlei Hu
2024-09-15 09:46:34 +09:00
committed by GitHub
parent 9bdb3c0332
commit 347563adf9
3 changed files with 14 additions and 12 deletions

View File

@@ -22,3 +22,14 @@ export function formatCamelCase(str: string): string {
// Join the words with spaces
return processedWords.join(' ')
}
export function appendJsonExt(path: string) {
if (!path.toLowerCase().endsWith('.json')) {
path += '.json'
}
return path
}
export function trimJsonExt(path: string) {
return path.replace(/\.json$/, '')
}