Home Reference Source Repository

Function

Static Public Summary
public

from(iterable: Iterable): Sequence

Helper function that wraps the specified iterable instance in an ESLinq Sequence which can be queried using ESLinq operators (like 'select', 'where', etc.).

Static Public

public from(iterable: Iterable): Sequence source

import from from 'eslinq/src/eslinq.js'

Helper function that wraps the specified iterable instance in an ESLinq Sequence which can be queried using ESLinq operators (like 'select', 'where', etc.).

Params:

NameTypeAttributeDescription
iterable Iterable

An iterable object (like an Array, a Set, or any object with a [Symbol.iterator] property).

Return:

Sequence

An ESLinq Sequence which can be queried using ESLinq operators (like 'select', 'where', etc.).

Example:

const numbers = [1, 2, 3, 4, 5];
const squaresOfEvenNumbers =
    from(numbers)
        .where(n => n % 2 === 0)
        .select(n => n * n);

for (let n of squaresOfEvenNumbers)
    console.log(n); // 4 16