(dir: string, filename: string)
| 2825 | } |
| 2826 | |
| 2827 | async function uniqueFilename(dir: string, filename: string): Promise<string> { |
| 2828 | const ext = path.extname(filename) |
| 2829 | const base = path.basename(filename, ext) |
| 2830 | let candidate = filename |
| 2831 | let n = 2 |
| 2832 | while (true) { |
| 2833 | try { |
| 2834 | await fs.access(path.join(dir, candidate)) |
| 2835 | candidate = `${base} ${n}${ext}` |
| 2836 | n += 1 |
| 2837 | } catch { |
| 2838 | return candidate |
| 2839 | } |
| 2840 | } |
| 2841 | } |
| 2842 | |
| 2843 | function classifyImportedAsset(filename: string): ImportedAssetKind { |
| 2844 | const ext = path.extname(filename).toLowerCase() |
no outgoing calls
no test coverage detected