taraskevizer
Version:
Канвэртацыя акадэмічнага правапісу ў клясычны
17 lines (15 loc) • 416 B
JavaScript
import { TaraskConfig } from '../config.js';
export const pipe = (steps) => {
const fn = (text, cfg = new TaraskConfig()) => {
const ctx = {
text,
cfg: cfg instanceof TaraskConfig ? cfg : new TaraskConfig(cfg),
storage: {},
};
for (const step of fn.steps)
step(ctx);
return ctx.text;
};
fn.steps = steps;
return fn;
};