refactor(core): CORE-01 migrate utility contracts to TypeScript

This commit is contained in:
Harvey Zhao committed 2026-09-10 23:50:47 +08:00
1 parent e005e5f249
commit d3c695024a
33 files changed
+1269 -305

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
export function getExt(url: string): string {
const end = url.search(/[?#]/)
const clean = (end < 0 ? url : url.slice(0, end)).trim().toLowerCase()
return clean.slice(clean.lastIndexOf('.') + 1)
}
export function download(url: string, name: string): void {
const elink = document.createElement('a')
elink.style.display = 'none'
elink.href = url
elink.download = name
document.body.appendChild(elink)
try {
elink.click()
}
finally {
elink.remove()
}
}