Phantom Stories Library - v0.0.8
    Preparing search index...

    Enumeration ValidationTypes

    A sum type for validating data in a functional programming style. Represents two states: passing (Passing) with a value, or failing (Failing) with error messages. Supports functor (map), monad (chain, of), and semigroup (concat) operations for declarative validation. Designed for use with Redux Toolkit, Redux Observables, and React.

    The type of the data in Passing state.

    // Create a Validation for a passing value
    const passing = Validation.Passing(42);

    // Map the value
    const doubled = passing.map(x => x * 2); // Passing<84>

    // Render in React with matchWith
    const render = passing.matchWith({
    Passing: ({ value }) => <p>Valid: {value}</p>,
    Failing: ({ messages }) => <p>Errors: {messages.join(', ')}</p>,
    });
    Index

    Enumeration Members

    Enumeration Members

    Failing: "Failing"
    Passing: "Passing"