@metreeca/pipe - v0.9.11
    Preparing search index...

    Function toMap

    • Creates a sink collecting items into a map using item values.

      Type Parameters

      • V

        The type of items in the stream

      • K

        The type of map keys

      Parameters

      • key: (item: V) => K | Promise<K>

        The function to extract the key from each item

      Returns Sink<V, ReadonlyMap<K, V>>

      A sink that collects items into a map with keys from the key selector and items as values

    • Creates a sink collecting items into a map using custom keys and values.

      Type Parameters

      • V

        The type of items in the stream

      • K

        The type of map keys

      • R

        The type of map values

      Parameters

      • key: (item: V) => K | Promise<K>

        The function to extract the key from each item

      • value: (item: V) => R | Promise<R>

        The function to transform each item into a map value

      Returns Sink<V, ReadonlyMap<K, R>>

      A sink that collects items into a map with keys and values from the selectors