@szilanor/stream
    Preparing search index...

    Variable toObjectAsyncConst

    toObjectAsync: <T, TKey extends string | number | symbol, TValue>(
        keySelector: (entry: T) => TKey,
        valueSelector: (entry: T) => TValue,
    ) => AsyncCollectorFunction<T, Record<TKey, TValue>> = toRecordAsync

    Type Declaration

      • <T, TKey extends string | number | symbol, TValue>(
            keySelector: (entry: T) => TKey,
            valueSelector: (entry: T) => TValue,
        ): AsyncCollectorFunction<T, Record<TKey, TValue>>
      • Returns a collector that returns a Record from an Iterable.

        Type Parameters

        • T

          Type of items in the source.

        • TKey extends string | number | symbol

          Type of the key.

        • TValue

          Type of the value.

        Parameters

        • keySelector: (entry: T) => TKey

          A function that defines the key for each entry.

        • valueSelector: (entry: T) => TValue

          A function that defines the value for each entry.

        Returns AsyncCollectorFunction<T, Record<TKey, TValue>>

        Collector that returns a Record from an Iterable.

        const result = toRecordAsync((x) => x, (x) => x)([1, 2, 3]);
        console.log(result); // {1 => 1, 2 => 2, 3 => 3}