Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "subs/transduce"

Index

Functions

Functions

Const transduce

  • transduce<A, B, C>(src: Subscription<any, A>, xform: Transducer<A, B>, rfn: Reducer<C, B>, init?: C): Promise<C>
  • Returns a promise which subscribes to given input and transforms incoming values using given transducer xform and reducer rfn.

    remarks

    Once the input or the reducer is done, the promise will resolve with the final reduced result (or fail with error).

    example
    transduce(
      fromIterable(tx.range(10)),
      tx.map((x) => x * 10),
      tx.add()
    ).then((x) => console.log("result", x))
    
    // result 450

    Type parameters

    • A

    • B

    • C

    Parameters

    • src: Subscription<any, A>

      -

    • xform: Transducer<A, B>

      -

    • rfn: Reducer<C, B>

      -

    • Optional init: C

      -

    Returns Promise<C>

Generated using TypeDoc