Function ifNotUndefined

  • Calls a function if the input value is not undefined. Return value from function is passed to next function in flow.

    const flow = Process.flow(
    Process.max(),
    Process.seenLastToUndefined(),
    Process.ifNotUndefined(v => {
    console.log(`v:`, v);
    })
    );
    flow(100); // Prints 'v:100'
    flow(90); // Nothing happens max value has not changed
    flow(110); // Prints 'v:110'

    Type Parameters

    • TIn
    • TOut

    Parameters

    • fn: ((value: Exclude<TIn, undefined>) => TOut)
        • (value): TOut
        • Parameters

          • value: Exclude<TIn, undefined>

          Returns TOut

    Returns ((value: TIn) => TIn | TOut)