• Creates a new instance of the passed in ctor with the Enumerable as input. Useful for custom iterables.

    Example

    class MyCustomEnumerable<T> extends Enumerable<T> {
    public foo(): void {
    console.log('hello');
    }
    }

    const items = [1, 2, 3];

    const asCustom = from(items).to(MyCustomEnumerable); // asCustom is now a MyCustomEnumerable instance.

    Typeparam

    TSource The type of the source iterable.

    Typeparam

    TResult The type of the returned object.

    Returns

    A new instance of the passed in ctor with the enumerable passed as input.

    Type Parameters

    • TSource

    • TResult

    Parameters

    • src: Iterable<TSource>

      The source Iterable.

    • ctor: (new (src: Iterable<TSource>) => TResult)

      The constructor function to create the result.

        • new (src: Iterable<TSource>): TResult
        • Parameters

          • src: Iterable<TSource>

          Returns TResult

    Returns TResult

Generated using TypeDoc