ensure

Returns a new event definition whose events will first go through the validator before being passed to their target. Events that don't pass the validator won't reach their targets.

Import

import ensure from '@redux-beacon/ensure';

Syntax

ensure(validator, eventDef)

Parameters

Validator

type Validator = (event: any[]) => boolean;
  • Accepts an event or array of events as its sole argument.

  • Returns true if the event is valid.

  • Returns false if the event is not valid.

Example

Last updated