Module

x/effector/packages/effector/index.d.ts>split

Business logic with ease ☄️
Latest
function split
import { split } from "https://dotland.deno.dev/x/effector@effector-vue%4023.1.0/packages/effector/index.d.ts";

Chooses one of the cases by given conditions. It "splits" source unit into several events, which fires when payload matches their conditions. Works like pattern matching for payload values and external stores

Type Parameters

S
Match extends { [name: string]: (payload: S) => boolean; }

Parameters

source: Unit<S>

unit which will trigger computation in split

match: Match

object with matching functions which allows to trigger one of created events

Returns

Show<[K in keyof Match]: Match[K] extends (p: any) => p is infer R ? Event<R> : Event<S> & { __: Event<S>; }>

Chooses one of cases by given conditions. It "splits" source unit into several targets, which fires when payload matches their conditions. Works like pattern matching for payload values and external units

Type Parameters

Cases
Source
Match extends (Unit<any> | ((p: UnitValue<Source>) => void) | Record<string, ((p: UnitValue<Source>) => boolean) | Store<boolean>>)
Clock

Parameters

config: { source: Source; match: Match; cases: Cases; clock: Clock; } extends infer Config ? Config extends { cases: CaseRecord; match: any; source: Unit<any>; clock: Unit<any> | Array<Unit<any>>; } ? Source extends Unit<any> ? Cases extends CaseRecord ? Clock extends Unit<any> | Array<Unit<any>> ? SplitType<Cases, Match, { source: Source; match: Match; cases: Cases; clock: Clock; }, Source> : { error: "clock should be a unit or array of units"; got: Clock; } : { error: "cases should be an object with units or arrays of units"; got: Cases; } : { error: "source should be a unit"; got: Source; } : Config extends { cases: CaseRecord; match: any; source: Unit<any>; } ? Source extends Unit<any> ? Cases extends CaseRecord ? SplitType<Cases, Match, { source: Source; match: Match; cases: Cases; }, Source> : { error: "cases should be an object with units or arrays of units"; got: Cases; } : { error: "source should be a unit"; got: Source; } : { error: "config should be object with fields \"source\", \"match\" and \"cases\""; got: Config; } : { error: "cannot infer config object"; }