Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "xform/multiplex-obj"

Index

Functions

Functions

multiplexObj

  • multiplexObj<A, B>(xforms: IObjectOf<TxLike<A, any>>, rfn?: Reducer<B, [PropertyKey, any]>): Transducer<A, B>
  • multiplexObj<A, B>(xforms: IObjectOf<TxLike<A, any>>, src: Iterable<A>): IterableIterator<B>
  • multiplexObj<A, B>(xforms: IObjectOf<TxLike<A, any>>, rfn: Reducer<B, [PropertyKey, any]>, src: Iterable<A>): IterableIterator<B>
  • Transducer. Similar to (and building on) {@link (multiplex:1)}, but takes an object of transducers and produces a result object for each input.

    example
    [...multiplexObj(
      {
        initial: map(x => x.charAt(0)),
        upper:   map(x => x.toUpperCase()),
        length:  map(x => x.length)
      },
      ["Alice", "Bob", "Charlie", "Andy"]
    )]
    // [ { length: 5, upper: 'ALICE', initial: 'A' },
    //   { length: 3, upper: 'BOB', initial: 'B' },
    //   { length: 7, upper: 'CHARLIE', initial: 'C' },
    //   { length: 4, upper: 'ANDY', initial: 'A' } ]

    Type parameters

    • A

    • B

    Parameters

    • xforms: IObjectOf<TxLike<A, any>>

      object of transducers

    • Optional rfn: Reducer<B, [PropertyKey, any]>

      -

    Returns Transducer<A, B>

  • Type parameters

    • A

    • B

    Parameters

    • xforms: IObjectOf<TxLike<A, any>>
    • src: Iterable<A>

    Returns IterableIterator<B>

  • Type parameters

    • A

    • B

    Parameters

    • xforms: IObjectOf<TxLike<A, any>>
    • rfn: Reducer<B, [PropertyKey, any]>
    • src: Iterable<A>

    Returns IterableIterator<B>

Generated using TypeDoc