Class List<TSource>

Interface that exposes an iterator, which supports a simple iteration and various methods.

TSource The type of elements in the IEnumerable.

Type Parameters

  • TSource

Hierarchy (View Summary)

Implements

Constructors

Accessors

Methods

  • Determines whether all elements of a sequence satisfy a condition.

    Parameters

    • predicate: (item: TSource, index: number) => boolean

      A function to test each element for a condition.

    Returns boolean

    true if every element of the source sequence passes the test in the specified predicate, or if the sequence is empty; otherwise, false.

    const numbers = [1, 2, 3, 4];
    const areAllNumbersEven = from(numbers).all(x => x % 2 === 0); // false
  • Determines whether any element of a sequence exists or satisfies a condition.

    Returns boolean

    true if the source sequence contains any elements (or if at least one matches condition if condition is passed); otherwise, false.

    const numbers = [1, 2, 3, 4];
    const areAnyNumbersEven = from(numbers).any(); // true
  • Determines whether any element of a sequence exists or satisfies a condition.

    Parameters

    • predicate: (item: TSource, index: number) => boolean

      A function to test each element for a condition.

    Returns boolean

    true if the source sequence contains any elements (or if at least one matches condition if condition is passed); otherwise, false.

    const numbers = [1, 2, 3, 4];
    const areAnyNumbersEven = from(numbers).any(x => x % 2 === 0); // true
  • Tests a sequence with a given predicate. An error will be thrown if any element fails the sequence.

    Parameters

    • predicate: (item: TSource, index: number) => boolean

      A function to test each element for a condition. If false, an error will be thrown.

    Returns IEnumerable<TSource>

    A sequence with source elements in their original order.

    const items = [1, 2, '3'];
    const sum = from(items).assert(x => typeof x === 'number').sum(); // throws due to '3'
  • Tests a sequence with a given predicate. An error will be thrown if any element fails the sequence.

    Parameters

    • predicate: (item: TSource, index: number) => boolean

      A function to test each element for a condition. If false, an error will be thrown.

    • message: string

      The message to use for thrown errors.

    Returns IEnumerable<TSource>

    A sequence with source elements in their original order.

    const items = [1, 2, '3'];
    const sum = from(items).assert(x => typeof x === 'number', 'Should be number').sum(); // throws due to '3'
  • Tests a sequence with a given predicate. An error will be thrown if any element fails the sequence.

    Type Parameters

    • TError extends Error

    Parameters

    • predicate: (item: TSource, index: number) => boolean

      A function to test each element for a condition. If false, an error will be thrown.

    • errorType: new (message?: string) => TError

      Type of error to throw.

    Returns IEnumerable<TSource>

    A sequence with source elements in their original order.

    class MyError extends Error {}
    const items = [1, 2, '3'];
    const sum = from(items).assert(x => typeof x === 'number', MyError).sum(); // throws instance of MyError due to '3'

    TError The type of error to be thrown.

  • Tests a sequence with a given predicate. An error will be thrown if any element fails the sequence.

    Type Parameters

    • TError extends Error

    Parameters

    • predicate: (item: TSource, index: number) => boolean

      A function to test each element for a condition. If false, an error will be thrown.

    • message: string

      The message to use for thrown errors.

    • errorType: new (message?: string) => TError

      Type of error to throw.

    Returns IEnumerable<TSource>

    A sequence with source elements in their original order.

    class MyError extends Error {}
    const items = [1, 2, '3'];
    const sum = from(items).assert(x => typeof x === 'number', 'Must be number', MyError).sum(); // throws instance of MyError with message due to '3'

    TError The type of error to be thrown.

  • Determines whether or not the number of elements in the sequence is greater than or equal to the given integer.

    Parameters

    • count: number

      The minimum number of items a sequence must have for this function to return true

    Returns boolean

    true if the number of elements in the sequence is greater than or equal to the given integer or false otherwise.

    const items = [1, 2, 3];
    const atLeastThree = from(items).atLeast(3); // true
    const atLeastFour = from(items).atLeast(4); // false
  • Determines whether or not the number of elements in the sequence is greater than or equal to the given integer.

    Parameters

    • count: number

      The minimum number of items a sequence must have for this function to return true

    • predicate: (item: TSource, index: number) => boolean

      A function to test each element for a condition.

    Returns boolean

    true if the number of elements in the sequence is greater than or equal to the given integer or false otherwise.

    const items = [1, 2, 3];
    const atLeastOneEven = from(items).atLeast(1, x => x % 2 === 0); // true
    const atLeastTwoEven = from(items).atLeast(2, x => x % 2 === 0); // false
  • Determines whether or not the number of elements in the sequence is lesser than or equal to the given integer.

    Parameters

    • count: number

      The maximun number of items a sequence must have for this function to return true.

    Returns boolean

    true if the number of elements in the sequence is lesser than or equal to the given integer or false otherwise.

    const items = [1, 2, 3];
    const atMostTwo = from(items).atMost(2); // false
    const atMostFour = from(items).atMost(4); // true
  • Determines whether or not the number of elements that match the predicate in the sequence is lesser than or equal to the given integer.

    Parameters

    • count: number

      The maximun number of items a sequence must have for this function to return true.

    • predicate: (item: TSource, index: number) => boolean

      The condition to match the elements by.

    Returns boolean

    true if the number of elements that match the predicate in the sequence is lesser than or equal to the given integer or false otherwise.

    const items = [1, 2, 3];
    const atMostTwo = from(items).atMost(2, x => x > 0); // false
    const atMostFour = from(items).atMost(4, x => x > 2); // true
  • Computes the average of a sequence of numeric values.

    Returns number

    The average of the sequence of values.

    const numbers = [2, 2, 1, 3];
    const average = from(numbers).average(); // 2
  • Computes the average of a sequence of numeric values.

    Parameters

    • selector: (item: TSource) => number

      A transform function to apply to each element.

    Returns number

    The average of the sequence of values.

    const numbers = [{ age: 20 }, { age: 10 }, { age: 30 }];
    const average = from(numbers).average(x => x.age); // 20
  • Determines whether a sequence contains a specified element.

    Parameters

    • value: TSource

      The value to locate in the sequence.

    Returns boolean

    true if the source sequence contains an element that has the specified value; otherwise, false.

    const numbers = [1, 2, 3];
    const hasThree = from(numbers).contains(3); // true
  • Determines whether a sequence contains a specified element.

    Parameters

    Returns boolean

    true if the source sequence contains an element that has the specified value; otherwise, false.

    const numbers = [1, 2, 3];
    const hasThree = from(numbers).contains(3, (a, b) => a === b); // true
  • Returns the number of elements in a sequence.

    Returns number

    The number of elements in the input sequence.

    const numbers = [1, 2, 3];
    const numCount = from(numbers).count(); // 3
  • Returns the number of elements in a sequence.

    Parameters

    • predicate: (item: TSource, index: number) => boolean

      A function to test each element for a condition.

    Returns number

    The number of elements in the input sequence.

    const numbers = [1, 2, 3];
    const evenNumCount = from(numbers).count(x => x % 2 === 0); // 1
  • Returns distinct elements from a sequence according to a specified key selector function.

    Type Parameters

    • TKey

    Parameters

    • keySelector: (item: TSource) => TKey

      A function to extract the key for each element.

    Returns IEnumerable<TSource>

    An IEnumerable that contains distinct elements from the source sequence.

    const items = [{ name: 'bob', id: 1 }, { name: 'Joe', id: 2 }, { name: 'Bob', id: 3 }, { name: 'John', id: 2 }];
    const distinct = from(items).distinctBy(x => x.id); // Will be [{ name: 'bob', id: 1 }, { name: 'Joe', id: 2 }, { name: 'Bob', id: 3 }]

    TKey The type of key to distinguish elements by.

  • Returns distinct elements from a sequence according to a specified key selector function.

    Type Parameters

    • TKey

    Parameters

    • keySelector: (item: TSource) => TKey

      A function to extract the key for each element.

    • equalityComparer: EqualityComparer<TKey>

      An EqualityComparer to compare values.

    Returns IEnumerable<TSource>

    An IEnumerable that contains distinct elements from the source sequence.

    const items = [{ name: 'bob', id: 1 }, { name: 'Joe', id: 2 }, { name: 'Bob', id: 3 }, { name: 'John', id: 2 }];
    const distinct = from(items).distinctBy(x => x.id, (a, b) => a === b); // Will be [{ name: 'bob', id: 1 }, { name: 'Joe', id: 2 }, { name: 'Bob', id: 3 }]

    TKey The type of key to distinguish elements by.

  • Returns the element at a specified index in a sequence or throws if the index is out of range. A negative index can be used to get element starting from the end.

    Parameters

    • index: number

      The zero-based index of the element to retrieve.

    Returns TSource

    The element at the specified position in the source sequence.

    const items = [1, 2, 3];
    const indexZero = from(items).elementAt(0); // Will be 1
    const willBeNull = from(items).elementAt(10); // Will throw.
    const last = from(items).elementAt(-1); // 3
  • Returns the element at a specified index in a sequence or null if the index is out of range. A negative index can be used to get element starting from the end.

    Parameters

    • index: number

      The zero-based index of the element to retrieve.

    Returns null | TSource

    The element at the specified position in the source sequence.

    const items = [1, 2, 3];
    const indexZero = from(items).elementAtOrDefault(0); // Will be 1
    const willBeNull = from(items).elementAtOrDefault(10); // Will be null.
    const last = from(items).elementAtOrDefault(-1); // 3
  • Determines whether the end of the first sequence is equivalent to the second sequence.

    Parameters

    • second: Iterable<TSource>

      The sequence to compare to.

    Returns boolean

    true if first ends with elements equivalent to second.

    const items = [1, 2, 3];
    const endsWith = from(items).endsWith([2, 3]); // true
    const doesNotEndWith = from(items).endsWith([3, 2]); // false
  • Determines whether the end of the first sequence is equivalent to the second sequence, using the specified element equality comparer.

    Parameters

    Returns boolean

    true if first ends with elements equivalent to second.

    const items = [1, 2, 3];
    const endsWith = from(items).endsWith([2, 3], (a, b) => a === b); // true
    const doesNotEndWith = from(items).endsWith([3, 2], (a, b) => a === b); // false
  • Produces the set difference of two sequences.

    Parameters

    • second: Iterable<TSource>

      An Iterable whose elements that also occur in the first sequence will cause those elements to be removed from the returned sequence.

    Returns IEnumerable<TSource>

    A sequence that contains the set difference of the elements of two sequences.

    const items = [1, 2, 3, 4];
    const exceptItems = from(items).except([2, 4]); // [1, 3]
  • Produces the set difference of two sequences.

    Parameters

    • ...second: Iterable<TSource>[]

      An Iterable whose elements that also occur in the first sequence will cause those elements to be removed from the returned sequence.

    Returns IEnumerable<TSource>

    A sequence that contains the set difference of the elements of two sequences.

    const items = [1, 2, 3, 4];
    const exceptItems = from(items).except([2, 4], [3, 4]); // [1]
  • Produces the set difference of two sequences.

    Parameters

    • second: Iterable<TSource>

      An Iterable whose elements that also occur in the first sequence will cause those elements to be removed from the returned sequence.

    • equalityComparer: EqualityComparer<TSource>

      An EqualityComparer to compare values.

    Returns IEnumerable<TSource>

    A sequence that contains the set difference of the elements of two sequences.

    const items = [1, 2, 3, 4];
    const exceptItems = from(items).except([2, 4], (a, b) => a === b); // [1, 3]
  • Produces the set difference of two sequences.

    Parameters

    • second: Iterable<TSource>

      An Iterable whose elements that also occur in the first sequence will cause those elements to be removed from the returned sequence.

    • third: Iterable<TSource>

      An Iterable whose elements that also occur in the first sequence will cause those elements to be removed from the returned sequence.

    • equalityComparer: EqualityComparer<TSource>

      An EqualityComparer to compare values.

    Returns IEnumerable<TSource>

    A sequence that contains the set difference of the elements of two sequences.

    const items = [1, 2, 3, 4];
    const exceptItems = from(items).except([2, 4], [3], (a, b) => a === b); // [1]
  • Produces the set difference of two sequences.

    Parameters

    • second: Iterable<TSource>

      An Iterable whose elements that also occur in the first sequence will cause those elements to be removed from the returned sequence.

    • third: Iterable<TSource>

      An Iterable whose elements that also occur in the first sequence will cause those elements to be removed from the returned sequence.

    • fourth: Iterable<TSource>

      An Iterable whose elements that also occur in the first sequence will cause those elements to be removed from the returned sequence.

    • equalityComparer: EqualityComparer<TSource>

      An EqualityComparer to compare values.

    Returns IEnumerable<TSource>

    A sequence that contains the set difference of the elements of two sequences.

    const items = [1, 2, 3, 4, 5, 6, 7];
    const exceptItems = from(items).except([2, 4], [3, 5], [7], (a, b) => a === b); // [1, 6]
  • Produces the set difference of two sequences according to a specified key selector function.

    Type Parameters

    • TKey

    Parameters

    • second: Iterable<TKey>

      An Iterable whose keys that also occur in the first sequence will cause those elements to be removed from the returned sequence.

    • keySelector: (item: TSource) => TKey

      A function to extract the key for each element.

    Returns IEnumerable<TSource>

    A sequence that contains the set difference of the elements of two sequences.

    TKey The type of key to identify elements by.

  • Produces the set difference of two sequences according to a specified key selector function.

    Type Parameters

    • TKey

    Parameters

    • second: Iterable<TKey>

      An Iterable whose keys that also occur in the first sequence will cause those elements to be removed from the returned sequence.

    • third: Iterable<TKey>

      An Iterable whose keys that also occur in the first sequence will cause those elements to be removed from the returned sequence.

    • keySelector: (item: TSource) => TKey

      A function to extract the key for each element.

    Returns IEnumerable<TSource>

    A sequence that contains the set difference of the elements of two sequences.

    TKey The type of key to identify elements by.

  • Produces the set difference of two sequences according to a specified key selector function.

    Type Parameters

    • TKey

    Parameters

    • second: Iterable<TKey>

      An Iterable whose keys that also occur in the first sequence will cause those elements to be removed from the returned sequence.

    • third: Iterable<TKey>

      An Iterable whose keys that also occur in the first sequence will cause those elements to be removed from the returned sequence.

    • fourth: Iterable<TKey>

      An Iterable whose keys that also occur in the first sequence will cause those elements to be removed from the returned sequence.

    • keySelector: (item: TSource) => TKey

      A function to extract the key for each element.

    Returns IEnumerable<TSource>

    A sequence that contains the set difference of the elements of two sequences.

    TKey The type of key to identify elements by.

  • Produces the set difference of two sequences according to a specified key selector function.

    Type Parameters

    • TKey

    Parameters

    • second: Iterable<TKey>

      An Iterable whose keys that also occur in the first sequence will cause those elements to be removed from the returned sequence.

    • keySelector: (item: TSource) => TKey

      A function to extract the key for each element.

    • equalityComparer: EqualityComparer<TKey>

      An EqualityComparer to compare values.

    Returns IEnumerable<TSource>

    A sequence that contains the set difference of the elements of two sequences.

    TKey The type of key to identify elements by.

  • Produces the set difference of two sequences according to a specified key selector function.

    Type Parameters

    • TKey

    Parameters

    • second: Iterable<TKey>

      An Iterable whose keys that also occur in the first sequence will cause those elements to be removed from the returned sequence.

    • thrid: Iterable<TKey>
    • keySelector: (item: TSource) => TKey

      A function to extract the key for each element.

    • equalityComparer: EqualityComparer<TKey>

      An EqualityComparer to compare values.

    Returns IEnumerable<TSource>

    A sequence that contains the set difference of the elements of two sequences.

    TKey The type of key to identify elements by.

  • Produces the set difference of two sequences according to a specified key selector function.

    Type Parameters

    • TKey

    Parameters

    • second: Iterable<TKey>

      An Iterable whose keys that also occur in the first sequence will cause those elements to be removed from the returned sequence.

    • thrid: Iterable<TKey>
    • fourth: Iterable<TKey>

      An Iterable whose keys that also occur in the first sequence will cause those elements to be removed from the returned sequence.

    • keySelector: (item: TSource) => TKey

      A function to extract the key for each element.

    • equalityComparer: EqualityComparer<TKey>

      An EqualityComparer to compare values.

    Returns IEnumerable<TSource>

    A sequence that contains the set difference of the elements of two sequences.

    TKey The type of key to identify elements by.

  • Parameters

    • predicate: (item: TSource, index: number) => boolean

    Returns number

  • Parameters

    • startIndex: number
    • predicate: (item: TSource, index: number) => boolean

    Returns number

  • Parameters

    • startIndex: number
    • count: number
    • predicate: (item: TSource, index: number) => boolean

    Returns number

  • Performs a full outer join on two heterogeneous sequences. Additional arguments specify key selection functions, result projection functions and a key comparer.

    Type Parameters

    • TSecond
    • TKey
    • TResult

    Parameters

    • second: Iterable<TSecond>

      The second sequence of the join operation.

    • firstKeySelector: (item: TSource) => TKey

      Function that projects the key given an element from first.

    • secondKeySelector: (item: TSecond) => TKey

      Function that projects the key given an element from second.

    • firstSelector: (item: TSource) => TResult
    • secondSelector: (item: TSecond) => TResult

      Function that projects the result given just an element from second where there is no corresponding element in first.

    • bothSelector: (a: TSource, b: TSecond) => TResult

      Function that projects the result given an element from first and an element from second that match on a common key.

    Returns IEnumerable<TResult>

    A sequence containing results projected from a right outer join of the two input sequences.

    TSecond The type of elements in the second sequence.

    TKey The type of the key returned by the key selector functions.

    TResult The type of the result elements.

  • Performs a full outer join on two heterogeneous sequences. Additional arguments specify key selection functions, result projection functions and a key comparer.

    Type Parameters

    • TSecond
    • TKey
    • TResult

    Parameters

    • second: Iterable<TSecond>

      The second sequence of the join operation.

    • firstKeySelector: (item: TSource) => TKey

      Function that projects the key given an element from first.

    • secondKeySelector: (item: TSecond) => TKey

      Function that projects the key given an element from second.

    • firstSelector: (item: TSource) => TResult
    • secondSelector: (item: TSecond) => TResult

      Function that projects the result given just an element from second where there is no corresponding element in first.

    • bothSelector: (a: TSource, b: TSecond) => TResult

      Function that projects the result given an element from first and an element from second that match on a common key.

    • equalityComparer: EqualityComparer<TKey>

      A function to compare keys.

    Returns IEnumerable<TResult>

    A sequence containing results projected from a right outer join of the two input sequences.

    TSecond The type of elements in the second sequence.

    TKey The type of the key returned by the key selector functions.

    TResult The type of the result elements.

  • Performs a full outer join on two homogeneous sequences. Additional arguments specify key selection functions and result projection functions.

    Type Parameters

    • TKey
    • TResult

    Parameters

    • second: Iterable<TSource>

      The second sequence of the join operation.

    • keySelector: (item: TSource) => TKey

      Function that projects the key given an element of one of the sequences to join.

    • firstSelector: (item: TSource) => TResult

      Function that projects the result given just an element from first where there is no corresponding element in second.

    • secondSelector: (item: TSource) => TResult

      Function that projects the result given just an element from second where there is no corresponding element in first.

    • bothSelector: (a: TSource, b: TSource) => TResult

      Function that projects the result given an element from first and an element from second that match on a common key.

    Returns IEnumerable<TResult>

    A sequence containing results projected from a full outer join of the two input sequences.

    TKey The type of the key returned by the key selector functions.

    TResult The type of the result elements.

  • Performs a full outer join on two homogeneous sequences. Additional arguments specify key selection functions and result projection functions.

    Type Parameters

    • TKey
    • TResult

    Parameters

    • second: Iterable<TSource>

      The second sequence of the join operation.

    • keySelector: (item: TSource) => TKey

      Function that projects the key given an element of one of the sequences to join.

    • firstSelector: (item: TSource) => TResult

      Function that projects the result given just an element from first where there is no corresponding element in second.

    • secondSelector: (item: TSource) => TResult

      Function that projects the result given just an element from second where there is no corresponding element in first.

    • bothSelector: (a: TSource, b: TSource) => TResult

      Function that projects the result given an element from first and an element from second that match on a common key.

    • equalityComparer: EqualityComparer<TKey>

      A function to compare keys.

    Returns IEnumerable<TResult>

    A sequence containing results projected from a full outer join of the two input sequences.

    TKey The type of the key returned by the key selector functions.

    TResult The type of the result elements.

  • Correlates the elements of two sequences based on key equality, and groups the results.

    Type Parameters

    • TInner
    • TKey
    • TResult

    Parameters

    • inner: Iterable<TInner>

      The sequence to join to the first sequence.

    • outerKeySelector: (item: TSource) => TKey

      A function to extract the join key from each element of the first sequence.

    • innerKeySelector: (item: TInner) => TKey

      A function to extract the join key from each element of the second sequence.

    • resultSelector: (item: TSource, inner: IEnumerable<TInner>) => TResult

      A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence.

    Returns IEnumerable<TResult>

    const magnus = { name: 'Magnus' };
    const terry = { name: 'Terry' };
    const adam = { name: 'Adam' };
    const john = { name: 'John' };

    const barley = { name: 'Barley', owner: terry };
    const boots = { name: 'Boots', owner: terry };
    const whiskers = { name: 'Whiskers', owner: adam };
    const daisy = { name: 'Daisy', owner: magnus };
    const scratchy = { name: 'Scratchy', owner: { name: 'Bob' } };

    const people = from([magnus, terry, adam, john]);
    const pets = from([barley, boots, whiskers, daisy, scratchy]);

    const result = people
    .groupJoin(
    pets,
    person => person,
    pet => pet.owner,
    (person, petCollection) => ({ ownerName: person.name, pets: petCollection.select(p => p.name).toArray() })
    )
    .toArray();

    expect(result).toEqual([
    { ownerName: 'Magnus', pets: ['Daisy'] },
    { ownerName: 'Terry', pets: ['Barley', 'Boots'] },
    { ownerName: 'Adam', pets: ['Whiskers'] },
    { ownerName: 'John', pets: [] }
    ]);

    TInner The type of the elements of the second sequence.

    TKey The type of the keys returned by the key selector functions.

    TResult The type of the result elements.

  • Correlates the elements of two sequences based on key equality, and groups the results.

    Type Parameters

    • TInner
    • TKey
    • TResult

    Parameters

    • inner: Iterable<TInner>

      The sequence to join to the first sequence.

    • outerKeySelector: (item: TSource) => TKey

      A function to extract the join key from each element of the first sequence.

    • innerKeySelector: (item: TInner) => TKey

      A function to extract the join key from each element of the second sequence.

    • resultSelector: (item: TSource, inner: IEnumerable<TInner>) => TResult

      A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence.

    • equalityComparer: EqualityComparer<TKey>

      An IEnumerable that contains elements of type TResult that are obtained by performing a grouped join on two sequences.

    Returns IEnumerable<TResult>

    const magnus = { name: 'Magnus' };
    const terry = { name: 'Terry' };
    const adam = { name: 'Adam' };
    const john = { name: 'John' };

    const barley = { name: 'Barley', owner: terry };
    const boots = { name: 'Boots', owner: terry };
    const whiskers = { name: 'Whiskers', owner: adam };
    const daisy = { name: 'Daisy', owner: magnus };
    const scratchy = { name: 'Scratchy', owner: { name: 'Bob' } };

    const people = from([magnus, terry, adam, john]);
    const pets = from([barley, boots, whiskers, daisy, scratchy]);

    const result = people
    .groupJoin(
    pets,
    person => person,
    pet => pet.owner,
    (person, petCollection) => ({ ownerName: person.name, pets: petCollection.select(p => p.name).toArray() }),
    (person, pet) => person.name === pet.owner.name
    )
    .toArray();

    expect(result).toEqual([
    { ownerName: 'Magnus', pets: ['Daisy'] },
    { ownerName: 'Terry', pets: ['Barley', 'Boots'] },
    { ownerName: 'Adam', pets: ['Whiskers'] },
    { ownerName: 'John', pets: [] }
    ]);

    TInner The type of the elements of the second sequence.

    TKey The type of the keys returned by the key selector functions.

    TResult The type of the result elements.

  • Performs an inner join by correlating the elements of two sequences based on matching keys.

    Type Parameters

    • TInner
    • TKey
    • TResult

    Parameters

    • inner: Iterable<TInner>

      The second sequence to join to the first.

    • outerKeySelector: (item: TSource) => TKey

      A function to extract the join key from each element of the first sequence.

    • innerKeySelector: (item: TInner) => TKey

      A function to extract the join key from each element of the second sequence.

    • resultSelector: (item: TSource, inner: TInner) => TResult

      A function to create a result element from two matching elements.

    Returns IEnumerable<TResult>

    An IEnumerable that has elements of type TResult that are obtained by performing an inner join on two sequences.

    const magnus = { name: 'Magnus' };
    const terry = { name: 'Terry' };
    const adam = { name: 'Adam' };
    const john = { name: 'John' };

    const barley = { name: 'Barley', owner: terry };
    const boots = { name: 'Boots', owner: terry };
    const whiskers = { name: 'Whiskers', owner: adam };
    const daisy = { name: 'Daisy', owner: magnus };
    const scratchy = { name: 'Scratchy', owner: { name: 'Bob' } };

    const people = from([magnus, terry, adam, john]);
    const pets = from([barley, boots, whiskers, daisy, scratchy]);

    const result = people.innerJoin(
    pets,
    person => person,
    pet => pet.owner,
    (person, pet) => ({ ownerName: person.name, pet: pet.name })
    )
    .toArray();

    expect(result).toEqual([
    { ownerName: 'Magnus', pet: 'Daisy' },
    { ownerName: 'Terry', pet: 'Barley' },
    { ownerName: 'Terry', pet: 'Boots' },
    { ownerName: 'Adam', pet: 'Whiskers' }
    ]);

    TInner The type of the elements of the second sequence.

    TKey The type of the keys returned by the key selector functions.

    TResult The type of the result elements.

  • Performs an inner join by correlating the elements of two sequences based on matching keys.

    Type Parameters

    • TInner
    • TKey
    • TResult

    Parameters

    • inner: Iterable<TInner>

      The second sequence to join to the first.

    • outerKeySelector: (item: TSource) => TKey

      A function to extract the join key from each element of the first sequence.

    • innerKeySelector: (item: TInner) => TKey

      A function to extract the join key from each element of the second sequence.

    • resultSelector: (item: TSource, inner: TInner) => TResult

      A function to create a result element from two matching elements.

    • equalityComparer: EqualityComparer<TKey>

      A function to compare keys.

    Returns IEnumerable<TResult>

    An IEnumerable that has elements of type TResult that are obtained by performing an inner join on two sequences.

    const magnus = { name: 'Magnus' };
    const terry = { name: 'Terry' };
    const adam = { name: 'Adam' };
    const john = { name: 'John' };

    const barley = { name: 'Barley', owner: terry };
    const boots = { name: 'Boots', owner: terry };
    const whiskers = { name: 'Whiskers', owner: adam };
    const daisy = { name: 'Daisy', owner: magnus };
    const scratchy = { name: 'Scratchy', owner: { name: 'Bob' } };

    const people = from([magnus, terry, adam, john]);
    const pets = from([barley, boots, whiskers, daisy, scratchy]);

    const result = people.innerJoin(
    pets,
    person => person,
    pet => pet.owner,
    (person, pet) => ({ ownerName: person.name, pet: pet.name }),
    (person, pet) => person.name === pet.owner.name
    )
    .toArray();

    expect(result).toEqual([
    { ownerName: 'Magnus', pet: 'Daisy' },
    { ownerName: 'Terry', pet: 'Barley' },
    { ownerName: 'Terry', pet: 'Boots' },
    { ownerName: 'Adam', pet: 'Whiskers' }
    ]);

    TInner The type of the elements of the second sequence.

    TKey The type of the keys returned by the key selector functions.

    TResult The type of the result elements.

  • Produces the set intersection of two sequences according to a specified key selector function.

    Type Parameters

    • TKey

    Parameters

    • second: Iterable<TKey>

      An IEnumerable whose distinct elements that also appear in the first sequence will be returned.

    • keySelector: (item: TSource) => TKey

      A function to extract the key for each element.

    Returns IEnumerable<TSource>

    A sequence that contains the elements that form the set intersection of two sequences.

    TKey The type of key to identify elements by.

  • Produces the set intersection of two sequences according to a specified key selector function.

    Type Parameters

    • TKey

    Parameters

    • second: Iterable<TKey>

      An IEnumerable whose distinct elements that also appear in the first sequence will be returned.

    • third: Iterable<TSource>

      An IEnumerable whose distinct elements that also appear in the first sequence will be returned.

    • keySelector: (item: TSource) => TKey

      A function to extract the key for each element.

    Returns IEnumerable<TSource>

    A sequence that contains the elements that form the set intersection of two sequences.

    TKey The type of key to identify elements by.

  • Produces the set intersection of two sequences according to a specified key selector function.

    Type Parameters

    • TKey

    Parameters

    • second: Iterable<TKey>

      An IEnumerable whose distinct elements that also appear in the first sequence will be returned.

    • third: Iterable<TSource>

      An IEnumerable whose distinct elements that also appear in the first sequence will be returned.

    • fourth: Iterable<TSource>

      An IEnumerable whose distinct elements that also appear in the first sequence will be returned.

    • keySelector: (item: TSource) => TKey

      A function to extract the key for each element.

    Returns IEnumerable<TSource>

    A sequence that contains the elements that form the set intersection of two sequences.

    TKey The type of key to identify elements by.

  • Produces the set intersection of two sequences according to a specified key selector function.

    Type Parameters

    • TKey

    Parameters

    • second: Iterable<TKey>

      An IEnumerable whose distinct elements that also appear in the first sequence will be returned.

    • keySelector: (item: TSource) => TKey

      A function to extract the key for each element.

    • equalityComparer: EqualityComparer<TKey>

      A function to compare keys.

    Returns IEnumerable<TSource>

    A sequence that contains the elements that form the set intersection of two sequences.

    TKey The type of key to identify elements by.

  • Produces the set intersection of two sequences according to a specified key selector function.

    Type Parameters

    • TKey

    Parameters

    • second: Iterable<TKey>

      An IEnumerable whose distinct elements that also appear in the first sequence will be returned.

    • third: Iterable<TSource>

      An IEnumerable whose distinct elements that also appear in the first sequence will be returned.

    • keySelector: (item: TSource) => TKey

      A function to extract the key for each element.

    • equalityComparer: EqualityComparer<TKey>

      A function to compare keys.

    Returns IEnumerable<TSource>

    A sequence that contains the elements that form the set intersection of two sequences.

    TKey The type of key to identify elements by.

  • Produces the set intersection of two sequences according to a specified key selector function.

    Type Parameters

    • TKey

    Parameters

    • second: Iterable<TKey>

      An IEnumerable whose distinct elements that also appear in the first sequence will be returned.

    • third: Iterable<TSource>

      An IEnumerable whose distinct elements that also appear in the first sequence will be returned.

    • fourth: Iterable<TSource>

      An IEnumerable whose distinct elements that also appear in the first sequence will be returned.

    • keySelector: (item: TSource) => TKey

      A function to extract the key for each element.

    • equalityComparer: EqualityComparer<TKey>

      A function to compare keys.

    Returns IEnumerable<TSource>

    A sequence that contains the elements that form the set intersection of two sequences.

    TKey The type of key to identify elements by.

  • Computes the quantile of a sequence of numbers. Note this will throw an exception if sequence has something other than numbers.

    Parameters

    • q: number

      The percentile to compute (25, 50, etc.)

    Returns number

    The percentile of the sequence.

    const items = [1, 2, 2, 3, 4];
    const q = from(items).quantile(50); // Will be 2
  • Computes the quantile of a sequence.

    Parameters

    • selector: (item: TSource) => number

      A function to extract a value from each element.

    • q: number

      The percentile to compute (25, 50, etc.)

    Returns number

    The percentile of the sequence.

    const items = [{ age: 1 }, { age: 2 }, { age: 2 }, { age: 3 }, { age: 4 }];
    const q = from(items).quantile(x => x.age, 50); // Will be 2
  • Performs a right outer join on two heterogeneous sequences.

    Type Parameters

    • TSecond
    • TKey
    • TResult

    Parameters

    • second: Iterable<TSecond>

      The second sequence of the join operation.

    • firstKeySelector: (item: TSource) => TKey

      Function that projects the key given an element from first.

    • secondKeySelector: (item: TSecond) => TKey

      Function that projects the key given an element from second.

    • secondSelector: (item: TSecond) => TResult

      Function that projects the result given just an element from second where there is no corresponding element in first.

    • bothSelector: (a: TSource, b: TSecond) => TResult

      Function that projects the result given an element from first and an element from second that match on a common key.

    Returns IEnumerable<TResult>

    A sequence containing results projected from a right outer join of the two input sequences.

    const right = 'right';
    const both = 'both';
    const missing = null;

    type Side = typeof right | typeof both;
    type Person = { name: string };
    type Pet = { name: string; owner: Person };

    const magnus: Person = { name: 'Magnus' };
    const terry: Person = { name: 'Terry' };
    const adam: Person = { name: 'Adam' };
    const john: Person = { name: 'John' };

    const barley: Pet = { name: 'Barley', owner: terry };
    const boots: Pet = { name: 'Boots', owner: terry };
    const whiskers: Pet = { name: 'Whiskers', owner: adam };
    const daisy: Pet = { name: 'Daisy', owner: magnus };
    const scratchy: Pet = { name: 'Scratchy', owner: { name: 'Bob' } };

    const people = from([magnus, terry, adam, john]);
    const pets = from([barley, boots, whiskers, daisy, scratchy]);

    const result = people.rightJoinHeterogeneous<Pet, Person, { side: Side; left: Person | null; right: Pet }>(
    pets,
    person => person,
    pet => pet.owner,
    pet => ({ side: right, left: missing, right: pet }),
    (person, pet) => ({ side: both, left: person, right: pet })
    )
    .toArray();

    expect(result).toEqual([
    { side: both, left: terry, right: barley },
    { side: both, left: terry, right: boots },
    { side: both, left: adam, right: whiskers },
    { side: both, left: magnus, right: daisy },
    { side: right, left: missing, right: scratchy } // Scratchy has an owner, Bob, but Bob is not in the calling collection, hence the 'missing'.
    ]);

    TSecond The type of elements in the second sequence.

    TKey The type of the key returned by the key selector functions.

    TResult The type of the result elements.

  • Performs a right outer join on two heterogeneous sequences.

    Type Parameters

    • TSecond
    • TKey
    • TResult

    Parameters

    • second: Iterable<TSecond>

      The second sequence of the join operation.

    • firstKeySelector: (item: TSource) => TKey

      Function that projects the key given an element from first.

    • secondKeySelector: (item: TSecond) => TKey

      Function that projects the key given an element from second.

    • secondSelector: (item: TSecond) => TResult

      Function that projects the result given just an element from second where there is no corresponding element in first.

    • bothSelector: (a: TSource, b: TSecond) => TResult

      Function that projects the result given an element from first and an element from second that match on a common key.

    • equalityComparer: EqualityComparer<TKey>

      A function to compare keys.

    Returns IEnumerable<TResult>

    A sequence containing results projected from a right outer join of the two input sequences.

    const right = 'right';
    const both = 'both';
    const missing = null;

    type Side = typeof right | typeof both;
    type Person = { name: string };
    type Pet = { name: string; owner: Person };

    const magnus: Person = { name: 'Magnus' };
    const terry: Person = { name: 'Terry' };
    const adam: Person = { name: 'Adam' };
    const john: Person = { name: 'John' };

    const barley: Pet = { name: 'Barley', owner: terry };
    const boots: Pet = { name: 'Boots', owner: terry };
    const whiskers: Pet = { name: 'Whiskers', owner: adam };
    const daisy: Pet = { name: 'Daisy', owner: magnus };
    const scratchy: Pet = { name: 'Scratchy', owner: { name: 'Bob' } };

    const people = from([magnus, terry, adam, john]);
    const pets = from([barley, boots, whiskers, daisy, scratchy]);

    const result = people.rightJoinHeterogeneous<Pet, Person, { side: Side; left: Person | null; right: Pet }>(
    pets,
    person => person,
    pet => pet.owner,
    pet => ({ side: right, left: missing, right: pet }),
    (person, pet) => ({ side: both, left: person, right: pet }),
    (person, pet) => person.name === pet.owner.name
    )
    .toArray();

    expect(result).toEqual([
    { side: both, left: terry, right: barley },
    { side: both, left: terry, right: boots },
    { side: both, left: adam, right: whiskers },
    { side: both, left: magnus, right: daisy },
    { side: right, left: missing, right: scratchy } // Scratchy has an owner, Bob, but Bob is not in the calling collection, hence the 'missing'.
    ]);

    TSecond The type of elements in the second sequence.

    TKey The type of the key returned by the key selector functions.

    TResult The type of the result elements.

  • Performs a right outer join on two homogeneous sequences.

    Type Parameters

    • TKey
    • TResult

    Parameters

    • second: Iterable<TSource>

      The second sequence of the join operation.

    • keySelector: (item: TSource) => TKey

      Function that projects the key given an element of one of the sequences to join.

    • secondSelector: (item: TSource) => TResult

      Function that projects the result given just an element from second where there is no corresponding element in first.

    • bothSelector: (a: TSource, b: TSource) => TResult

      Function that projects the result given an element from first and an element from second that match on a common key.

    Returns IEnumerable<TResult>

    A sequence containing results projected from a right outer join of the two input sequences.

    const right = 'right';
    const both = 'both';
    const missing = null;

    type Side = typeof right | typeof both;
    type Person = { id: number; name: string };

    const magnus: Person = { id: 1, name: 'Magnus' };
    const terry1: Person = { id: 2, name: 'Terry' };
    const adam: Person = { id: 3, name: 'Adam' };
    const john1: Person = { id: 4, name: 'John' };
    const john4: Person = { id: 9, name: 'John' };

    const john2: Person = { id: 5, name: 'John' };
    const jane: Person = { id: 6, name: 'Jane' };
    const terry2: Person = { id: 7, name: 'Terry' };
    const john3: Person = { id: 8, name: 'John' };

    const people1 = from([magnus, terry1, adam, john1, john4]);
    const people2 = from([john2, jane, terry2, john3]);

    const result = people1.rightJoinHomogeneous<string, { side: Side; left: Person | null; right: Person }>(
    people2,
    person => person.name,
    person => ({ side: right, left: missing, right: person }),
    (personLeft, personRight) => ({ side: both, left: personLeft, right: personRight })
    )
    .toArray();

    expect(result).toEqual([
    { side: both, left: john1, right: john2 },
    { side: both, left: john4, right: john2 },
    { side: right, left: missing, right: jane },
    { side: both, left: terry1, right: terry2 },
    { side: both, left: john1, right: john3 },
    { side: both, left: john4, right: john3 }
    ]);

    TSecond The type of elements in the second sequence.

    TKey The type of the key returned by the key selector functions.

    TResult The type of the result elements.

  • Performs a right outer join on two homogeneous sequences.

    Type Parameters

    • TKey
    • TResult

    Parameters

    • second: Iterable<TSource>

      The second sequence of the join operation.

    • keySelector: (item: TSource) => TKey

      Function that projects the key given an element of one of the sequences to join.

    • secondSelector: (item: TSource) => TResult

      Function that projects the result given just an element from second where there is no corresponding element in first.

    • bothSelector: (a: TSource, b: TSource) => TResult

      Function that projects the result given an element from first and an element from second that match on a common key.

    • equalityComparer: EqualityComparer<TKey>

      A function to compare keys.

    Returns IEnumerable<TResult>

    A sequence containing results projected from a right outer join of the two input sequences.

    const right = 'right';
    const both = 'both';
    const missing = null;

    type Side = typeof right | typeof both;
    type Person = { id: number; name: string };

    const magnus: Person = { id: 1, name: 'Magnus' };
    const terry1: Person = { id: 2, name: 'Terry' };
    const adam: Person = { id: 3, name: 'Adam' };
    const john1: Person = { id: 4, name: 'John' };
    const john4: Person = { id: 9, name: 'John' };

    const john2: Person = { id: 5, name: 'John' };
    const jane: Person = { id: 6, name: 'Jane' };
    const terry2: Person = { id: 7, name: 'Terry' };
    const john3: Person = { id: 8, name: 'John' };

    const people1 = from([magnus, terry1, adam, john1, john4]);
    const people2 = from([john2, jane, terry2, john3]);

    const result = people1.rightJoinHomogeneous<string, { side: Side; left: Person | null; right: Person }>(
    people2,
    person => person.name,
    person => ({ side: right, left: missing, right: person }),
    (personLeft, personRight) => ({ side: both, left: personLeft, right: personRight }),
    (keyLeft, keyRight) => keyLeft.toUpperCase() === keyRight.toUpperCase()
    )
    .toArray();

    expect(result).toEqual([
    { side: both, left: john1, right: john2 },
    { side: both, left: john4, right: john2 },
    { side: right, left: missing, right: jane },
    { side: both, left: terry1, right: terry2 },
    { side: both, left: john1, right: john3 },
    { side: both, left: john4, right: john3 }
    ]);

    TSecond The type of elements in the second sequence.

    TKey The type of the key returned by the key selector functions.

    TResult The type of the result elements.

  • Projects each element of a sequence to an IEnumerable and flattens the resulting sequences into one sequence.

    Type Parameters

    • TResult

    Parameters

    • selector: (item: TSource, index: number) => Iterable<TResult>

      A transform function to apply to each source element; the second parameter of the function represents the index of the source element.

    Returns IEnumerable<TResult>

    An IEnumerable whose elements are the result of invoking the one-to-many transform function on each element of an input sequence.

    TResult The type of the value returned by selector.

  • Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.

    Parameters

    • predicate: (item: TSource, index: number) => boolean

      A function to test each source element for a condition; the second parameter of the function represents the index of the source element.

    Returns IEnumerable<TSource>

    An IEnumerable that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.

  • Returns elements from a sequence as long as a specified condition is true, and then skips the remaining elements.

    Parameters

    • predicate: (item: TSource, index: number) => boolean

      A function to test each source element for a condition; the second parameter of the function represents the index of the source element.

    Returns IEnumerable<TSource>

    An IEnumerable that contains elements from the input sequence that occur before the element at which the test no longer passes.

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

    Type Parameters

    • TResult

    Parameters

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

      The constructor function to create the result.

    Returns TResult

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

    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.

    TResult The type of the returned object.

  • Creates a Map<TKey, TValue> from an IEnumerable according to specified key selector.

    Type Parameters

    • TKey

    Parameters

    • keySelector: (item: TSource) => TKey

      A function to extract a key from each element.

    Returns Map<TKey, TSource>

    A Map<TKey, TSource> that contains keys and values.

    TKey The type of the key returned by keySelector.

  • Creates a Map<TKey, TValue> from an IEnumerable according to specified key selector and element selector functions.

    Type Parameters

    • TKey
    • TValue

    Parameters

    • keySelector: (item: TSource) => TKey

      A function to extract a key from each element.

    • valueSelector: (item: TSource) => TValue

      A transform function to produce a result element value from each element.

    Returns Map<TKey, TValue>

    A Map<TKey, TValue> that contains keys and values.

    TKey The type of the key returned by keySelector.

    TValue The type of the value returned by valueSelector.

  • Returns an object with keys selected by keySelector and values of TSource.

    Parameters

    • keySelector: (item: TSource) => string

      A function to extract a key from each element.

    Returns Record<string, TSource>

    An object with keys selected by keySelector and values of TSource

  • Returns an object with keys selected by keySelector and values of TSource.

    Type Parameters

    • TValue

    Parameters

    • keySelector: (item: TSource) => string

      A function to extract a key from each element.

    • valueSelector: (item: TSource) => TValue

      A transform function to produce a result element value from each element.

    Returns Record<string, TValue>

    An object with keys selected by keySelector and values of TSource

    TValue The type of the value returned by valueSelector.

  • Produces the set union of two sequences according to a specified key selector function.

    Type Parameters

    • TKey

    Parameters

    • second: Iterable<TSource>

      An IEnumerable whose distinct elements form the second set for the union.

    • keySelector: (item: TSource) => TKey

      A function to extract the key for each element.

    Returns IEnumerable<TSource>

    An IEnumerable that contains the elements from both input sequences, excluding duplicates.

    TKey The type of key to identify elements by.

  • Produces the set union of two sequences according to a specified key selector function.

    Type Parameters

    • TKey

    Parameters

    • second: Iterable<TSource>

      An IEnumerable whose distinct elements form the second set for the union.

    • third: Iterable<TSource>

      An IEnumerable whose distinct elements form the third set for the union.

    • keySelector: (item: TSource) => TKey

      A function to extract the key for each element.

    Returns IEnumerable<TSource>

    An IEnumerable that contains the elements from both input sequences, excluding duplicates.

    TKey The type of key to identify elements by.

  • Produces the set union of two sequences according to a specified key selector function.

    Type Parameters

    • TKey

    Parameters

    • second: Iterable<TSource>

      An IEnumerable whose distinct elements form the second set for the union.

    • third: Iterable<TSource>

      An IEnumerable whose distinct elements form the third set for the union.

    • fourth: Iterable<TSource>

      An IEnumerable whose distinct elements form the fourth set for the union.

    • keySelector: (item: TSource) => TKey

      A function to extract the key for each element.

    Returns IEnumerable<TSource>

    An IEnumerable that contains the elements from both input sequences, excluding duplicates.

    TKey The type of key to identify elements by.

  • Produces the set union of two sequences according to a specified key selector function.

    Type Parameters

    • TKey

    Parameters

    • second: Iterable<TSource>

      An IEnumerable whose distinct elements form the second set for the union.

    • keySelector: (item: TSource) => TKey

      A function to extract the key for each element.

    • equalityComparer: EqualityComparer<TKey>

      The EqualityComparer to compare values.

    Returns IEnumerable<TSource>

    An IEnumerable that contains the elements from both input sequences, excluding duplicates.

    TKey The type of key to identify elements by.

  • Produces the set union of two sequences according to a specified key selector function.

    Type Parameters

    • TKey

    Parameters

    • second: Iterable<TSource>

      An IEnumerable whose distinct elements form the second set for the union.

    • third: Iterable<TSource>

      An IEnumerable whose distinct elements form the third set for the union.

    • keySelector: (item: TSource) => TKey

      A function to extract the key for each element.

    • equalityComparer: EqualityComparer<TKey>

      The EqualityComparer to compare values.

    Returns IEnumerable<TSource>

    An IEnumerable that contains the elements from both input sequences, excluding duplicates.

    TKey The type of key to identify elements by.

  • Produces the set union of two sequences according to a specified key selector function.

    Type Parameters

    • TKey

    Parameters

    • second: Iterable<TSource>

      An IEnumerable whose distinct elements form the second set for the union.

    • third: Iterable<TSource>

      An IEnumerable whose distinct elements form the third set for the union.

    • fourth: Iterable<TSource>

      An IEnumerable whose distinct elements form the fourth set for the union.

    • keySelector: (item: TSource) => TKey

      A function to extract the key for each element.

    • equalityComparer: EqualityComparer<TKey>

      The EqualityComparer to compare values.

    Returns IEnumerable<TSource>

    An IEnumerable that contains the elements from both input sequences, excluding duplicates.

    TKey The type of key to identify elements by.

  • Filters a sequence of values based on a predicate.

    Parameters

    • predicate: (item: TSource, index: number) => boolean

      A function to test each source element for a condition; the second parameter of the function represents the index of the source element.

    Returns IEnumerable<TSource>

    An IEnumerable that contains elements from the input sequence that satisfy the condition.

    const items = [1, 2, 3, 4, 5];
    const greaterThanTwo = from(items).where(x => x > 2); // Will be [3, 4, 5]
  • Produces the symmetric difference of two sequences according to a specified key selector function.

    Type Parameters

    • TKey

    Parameters

    • second: Iterable<TSource>

      An Iterable whose distinct elements form the second set for the symmetric difference.

    • keySelector: (item: TSource) => TKey

      A function to extract the key for each element.

    Returns IEnumerable<TSource>

    An IEnumerable that contains the symmetric difference from all input sequences, excluding duplicates.

    TKey The type of key to identify elements by.

  • Produces the symmetric difference of three sequences according to a specified key selector function.

    Type Parameters

    • TKey

    Parameters

    • second: Iterable<TSource>

      An Iterable whose distinct elements form the second set for the symmetric difference.

    • third: Iterable<TSource>

      An Iterable whose distinct elements form the third set for the symmetric difference.

    • keySelector: (item: TSource) => TKey

      A function to extract the key for each element.

    Returns IEnumerable<TSource>

    An IEnumerable that contains the symmetric difference from all input sequences, excluding duplicates.

    TKey The type of key to identify elements by.

  • Produces the symmetric difference of four sequences according to a specified key selector function.

    Type Parameters

    • TKey

    Parameters

    • second: Iterable<TSource>

      An Iterable whose distinct elements form the second set for the symmetric difference.

    • third: Iterable<TSource>

      An Iterable whose distinct elements form the third set for the symmetric difference.

    • fourth: Iterable<TSource>

      An Iterable whose distinct elements form the fourth set for the symmetric difference.

    • keySelector: (item: TSource) => TKey

      A function to extract the key for each element.

    Returns IEnumerable<TSource>

    An IEnumerable that contains the symmetric difference from all input sequences, excluding duplicates.

    TKey The type of key to identify elements by.

  • Produces the symmetric difference of two sequences according to a specified key selector function using a provided equality comparer.

    Type Parameters

    • TKey

    Parameters

    • second: Iterable<TSource>

      An Iterable whose distinct elements form the second set for the symmetric difference.

    • keySelector: (item: TSource) => TKey

      A function to extract the key for each element.

    • equalityComparer: EqualityComparer<TKey>

      The EqualityComparer to compare values.

    Returns IEnumerable<TSource>

    An IEnumerable that contains the symmetric difference from all input sequences, excluding duplicates.

    TKey The type of key to identify elements by.

  • Produces the symmetric difference of three sequences according to a specified key selector function using a provided equality comparer.

    Type Parameters

    • TKey

    Parameters

    • second: Iterable<TSource>

      An Iterable whose distinct elements form the second set for the symmetric difference.

    • third: Iterable<TSource>

      An Iterable whose distinct elements form the third set for the symmetric difference.

    • keySelector: (item: TSource) => TKey

      A function to extract the key for each element.

    • equalityComparer: EqualityComparer<TKey>

      The EqualityComparer to compare values.

    Returns IEnumerable<TSource>

    An IEnumerable that contains the symmetric difference from all input sequences, excluding duplicates.

    TKey The type of key to identify elements by.

  • Produces the symmetric difference of four sequences according to a specified key selector function using a provided equality comparer.

    Type Parameters

    • TKey

    Parameters

    • second: Iterable<TSource>

      An Iterable whose distinct elements form the second set for the symmetric difference.

    • third: Iterable<TSource>

      An Iterable whose distinct elements form the third set for the symmetric difference.

    • fourth: Iterable<TSource>

      An Iterable whose distinct elements form the fourth set for the symmetric difference.

    • keySelector: (item: TSource) => TKey

      A function to extract the key for each element.

    • equalityComparer: EqualityComparer<TKey>

      The EqualityComparer to compare values.

    Returns IEnumerable<TSource>

    An IEnumerable that contains the symmetric difference from all input sequences, excluding duplicates.

    TKey The type of key to identify elements by.