-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbatch-columns.ts
More file actions
23 lines (19 loc) · 862 Bytes
/
Copy pathbatch-columns.ts
File metadata and controls
23 lines (19 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/**
* The cataloger pipeline: transliterate a pasted column of names. The
* loader caches each map after first use, so the whole column is one
* map fetch.
*/
import { transliterateAsync } from "../src/index.js"
import { configureSharedStack } from "./_lib/stack.js"
export const title = "Batch a column of names"
export const summary = "Tab-separated input in, transliterated column out — the MARC batch shape."
export const expected = ["Anton Olehovych", "Solomiia", "Kyiv"].join("\n")
const COLUMN = ["Антон Олегович", "Соломія", "Київ"]
export async function run(): Promise<string> {
configureSharedStack()
const converted = new Array<string>(COLUMN.length)
for (const [i, name] of COLUMN.entries()) {
converted[i] = await transliterateAsync("bgnpcgn-ukr-Cyrl-Latn-2019", name)
}
return converted.join("\n")
}