(id: string)
| 89 | const dir = join(rootDir, subdir); |
| 90 | |
| 91 | function fileFor(id: string): string { |
| 92 | if (!idRegex.test(id)) { |
| 93 | throw new Error(`Invalid ${entityName}: "${id}"`); |
| 94 | } |
| 95 | return join(dir, `${id}.json`); |
| 96 | } |
| 97 | |
| 98 | async function write(id: string, value: T): Promise<void> { |
| 99 | const target = fileFor(id); |