UNPKG

taraskevizer

Version:

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

23 lines (22 loc) 932 B
import type { TaraskStep, AsyncTaraskStep } from '../steps/types'; /** * Utility function for a step that always modifies the text * * > Not recommended to use if * a step doesn't ALWAYS modify the text. * * @example * type TextWrapperStorage = { wrapText: (text: string) => string }; * * const trimStep = mutatingStep<TextWrapperStorage>( * ({ text, storage: { wrapText } }) => wrapText(text.trim()) * ); * // is equivalent to * const trimStep: TaraskStep<TextWrapperStorage> = (ctx) => { * ctx.text = options.storage.wrapText( * ctx.text.trim() * ); * }; */ export declare const mutatingStep: <TStorage extends object = object>(callback: (...args: Parameters<TaraskStep<TStorage>>) => string) => TaraskStep<TStorage>; export declare const mutatingAsyncStep: <TStorage extends object = object>(callback: (...args: Parameters<AsyncTaraskStep<TStorage>>) => Promise<string>) => AsyncTaraskStep<TStorage>;