UNPKG

@connectv/core

Version:

agent-based reactive programming library for typescript/javascript

55 lines (54 loc) 1.73 kB
import { PinLike } from '../pin/pin-like'; import { FilterFunc } from '../pin/filter'; import { Agent } from './agent'; /** * * Represents [check](https://connective.dev/docs/check) agents. * */ export declare class Check extends Agent { readonly predicate: FilterFunc; private core; /** * * @param predicate the predicate function to pass or fail incoming values against. * */ constructor(predicate: FilterFunc); /** * * Shortcut for `.in('value')`, the main value input for this check. * [Read this](https://connective.dev/docs/check#signature) for more details. * */ get input(): PinLike; /** * * Shortcut for `.out('pass')`, the output for values passing the criteria outline by given predicate. * [Read this](https://connective.dev/docs/check#signature) for more details. * */ get pass(): PinLike; /** * * Shortcut for `.out('fail')`, the output for values failing the criteria outline by given predicate. * [Read this](https://connective.dev/docs/check#signature) for more details. * */ get fail(): PinLike; protected createOutput(label: string): PinLike; protected createEntries(): PinLike[]; protected createExits(): PinLike[]; } /** * * Creates a [check](https://connective.dev/docs/check) agent. A check agent * will pass or fail incoming values based on given predicate, passing them through * the corresponding outputs. * [Checkout the docs](https://connective.dev/docs/check) for examples and further information. * * @param func the predicate to test incoming values against * */ export declare function check(func: FilterFunc): Check; export default check;