Function intersect

  • Creates a new Consumable that intersects another Consumable. The new Consumable updates and dispatches whenever the other Consumable changes.

    Type Parameters

    • T

    • K

    Parameters

    • other: IConsumable<T>
    • intersector: ((val) => K)
        • (val): K
        • Parameters

          • val: T

          Returns K

    Returns IConsumable<K>

    Example

    const value = createConsumable(2);
    const isGreater = intersect(cons, (value) => value > 5);
    // > isGreater == false;
    value.dispatch(6);
    // > isGreater == true;

Generated using TypeDoc