Skip to main content

Function: processor()

processor<TInput, TOutput>(processFn, options?): Processable<TInput, TOutput> & (input, opts?) => Promise<TOutput>

Defined in: packages/core/src/deterministic.ts:522

Simpler alias for creating a processor from a plain function Same as processable() but reads more naturally for simple transforms

Type Parameters

TInput

TInput = unknown

TOutput

TOutput = unknown

Parameters

processFn

(input, options?) => TOutput | Promise<TOutput>

options?

id?

string

name?

string

Returns

Processable<TInput, TOutput> & (input, opts?) => Promise<TOutput>

Example

const trimmer = processor((text: string) => text.trim(), { name: 'trim' });
const result = await trimmer(' hello '); // 'hello'