This commit is contained in:
2026-02-04 00:06:16 -05:00
parent f08afb2ed1
commit 7b5c256e07
38 changed files with 933 additions and 1 deletions

View File

@@ -0,0 +1,10 @@
export type DetectedFormat = "json" | "xml" | "unknown"
export function detectFormat(filePath: string): DetectedFormat {
const length = filePath.length
const jsonSuffix = length >= 5 ? filePath.substr(length - 5) : ""
const xmlSuffix = length >= 4 ? filePath.substr(length - 4) : ""
if (jsonSuffix === ".json" || jsonSuffix === ".JSON") return "json"
if (xmlSuffix === ".xml" || xmlSuffix === ".XML") return "xml"
return "unknown"
}