UNPKG

taraskevizer

Version:

Канвэртацыя акадэмічнага правапісу ў клясычны

17 lines (16 loc) 455 B
const prefix = '[debug]'; export const dict = (dict, regex) => { const fn = (text) => fn.value.reduce((acc, item) => { if (regex.test(acc)) { console.log(prefix, 'replaceWithDict:', item, acc); process.exit(1); } return acc.replace(item[0], item[1]); }, text); fn.value = dict.value; return fn; }; export const trace = (...msgs) => { console.log(prefix, ...msgs); return msgs[0]; };