Resolve a unique id when the slug already exists (append -2, -3, …).
(cwd: string, base: string)
| 157 | |
| 158 | /** Resolve a unique id when the slug already exists (append -2, -3, …). */ |
| 159 | async function uniqueId(cwd: string, base: string): Promise<string> { |
| 160 | let id = base; |
| 161 | let n = 2; |
| 162 | while (await readManifest(cwd, id)) { |
| 163 | id = `${base}-${n++}`; |
| 164 | } |
| 165 | return id; |
| 166 | } |
| 167 | |
| 168 | export interface CreateInput { title: string; type: ArtifactType; content: string; note?: string; } |
| 169 |
no test coverage detected