import { EnumerableFactory } from '../utilities/EnumerableFactory'; import { IEnumerable } from '../types'; import { EqualityComparer } from '../types'; import { applyXor } from './applicators/applyXor'; /** * Produces the symmetric difference of two sequences. * @typeparam TSource The type of source elements. * @param src The source Iterable * @param second The second Iterable whose distinct elements form the second or more set for the symmetric difference. * @returns An IEnumerable that contains the symmetric difference from all input sequences, excluding duplicates. */ export function xor(src: Iterable, second: Iterable): IEnumerable; /** * Produces the symmetric difference of two or more sequences. * @typeparam TSource The type of source elements. * @param src The source Iterable * @param second One or more Iterable whose distinct elements form the second or more set for the symmetric difference. * @returns An IEnumerable that contains the symmetric difference from all input sequences, excluding duplicates. */ export function xor(src: Iterable, ...second: Iterable[]): IEnumerable; /** * Produces the symmetric difference of two sequences using a provided equality comparer. * @typeparam TSource The type of source elements. * @param src The source Iterable * @param second An Iterable whose distinct elements form the second set for the symmetric difference. * @param equalityComparer The EqualityComparer to compare values. * @returns An IEnumerable that contains the symmetric difference from all input sequences, excluding duplicates. */ export function xor( src: Iterable, second: Iterable, equalityComparer: EqualityComparer ): IEnumerable; /** * Produces the symmetric difference of three sequences using a provided equality comparer. * @typeparam TSource The type of source elements. * @param src The source Iterable * @param second An Iterable whose distinct elements form the second set for the symmetric difference. * @param third An Iterable whose distinct elements form the third set for the symmetric difference. * @param equalityComparer The EqualityComparer to compare values. * @returns An IEnumerable that contains the symmetric difference from all input sequences, excluding duplicates. */ export function xor( src: Iterable, second: Iterable, third: Iterable, equalityComparer: EqualityComparer ): IEnumerable; /** * Produces the symmetric difference of four sequences using a provided equality comparer. * @typeparam TSource The type of source elements. * @param src The source Iterable * @param second An Iterable whose distinct elements form the second set for the symmetric difference. * @param third An Iterable whose distinct elements form the third set for the symmetric difference. * @param fourth An Iterable whose distinct elements form the fourth set for the symmetric difference. * @param equalityComparer The EqualityComparer to compare values. * @returns An IEnumerable that contains the symmetric difference from all input sequences, excluding duplicates. */ export function xor( src: Iterable, second: Iterable, third: Iterable, fourth: Iterable, equalityComparer: EqualityComparer ): IEnumerable; export function xor( src: Iterable, ...second: (Iterable | EqualityComparer)[] ): IEnumerable { return applyXor(new EnumerableFactory(), (x: TSource) => x, src, second); } /** * Produces the symmetric difference of two sequences according to a specified key selector function. * @typeparam TSource The type of source elements. * @typeparam TKey The type of key to identify elements by. * @param src The source Iterable * @param second An Iterable whose distinct elements form the second set for the symmetric difference. * @param keySelector A function to extract the key for each element. * @returns An IEnumerable that contains the symmetric difference from all input sequences, excluding duplicates. */ export function xorBy( src: Iterable, second: Iterable, keySelector: (item: TSource) => TKey ): IEnumerable; /** * Produces the symmetric difference of three sequences according to a specified key selector function. * @typeparam TSource The type of source elements. * @typeparam TKey The type of key to identify elements by. * @param src The source Iterable * @param second An Iterable whose distinct elements form the second set for the symmetric difference. * @param third An Iterable whose distinct elements form the third set for the symmetric difference. * @param keySelector A function to extract the key for each element. * @returns An IEnumerable that contains the symmetric difference from all input sequences, excluding duplicates. */ export function xorBy( src: Iterable, second: Iterable, third: Iterable, keySelector: (item: TSource) => TKey ): IEnumerable; /** * Produces the symmetric difference of four sequences according to a specified key selector function. * @typeparam TSource The type of source elements. * @typeparam TKey The type of key to identify elements by. * @param src The source Iterable * @param second An Iterable whose distinct elements form the second set for the symmetric difference. * @param third An Iterable whose distinct elements form the third set for the symmetric difference. * @param fourth An Iterable whose distinct elements form the fourth set for the symmetric difference. * @param keySelector A function to extract the key for each element. * @returns An IEnumerable that contains the symmetric difference from all input sequences, excluding duplicates. */ export function xorBy( src: Iterable, second: Iterable, third: Iterable, fourth: Iterable, keySelector: (item: TSource) => TKey ): IEnumerable; /** * Produces the symmetric difference of two sequences according to a specified key selector function using a provided equality comparer. * @typeparam TSource The type of source elements. * @typeparam TKey The type of key to identify elements by. * @param src The source Iterable * @param second An Iterable whose distinct elements form the second set for the symmetric difference. * @param keySelector A function to extract the key for each element. * @param equalityComparer The EqualityComparer to compare values. * @returns An IEnumerable that contains the symmetric difference from all input sequences, excluding duplicates. */ export function xorBy( src: Iterable, second: Iterable, keySelector: (item: TSource) => TKey, equalityComparer: EqualityComparer ): IEnumerable; /** * Produces the symmetric difference of three sequences according to a specified key selector function using a provided equality comparer. * @typeparam TSource The type of source elements. * @typeparam TKey The type of key to identify elements by. * @param src The source Iterable * @param second An Iterable whose distinct elements form the second set for the symmetric difference. * @param third An Iterable whose distinct elements form the third set for the symmetric difference. * @param keySelector A function to extract the key for each element. * @param equalityComparer The EqualityComparer to compare values. * @returns An IEnumerable that contains the symmetric difference from all input sequences, excluding duplicates. */ export function xorBy( src: Iterable, second: Iterable, third: Iterable, keySelector: (item: TSource) => TKey, equalityComparer: EqualityComparer ): IEnumerable; /** * Produces the symmetric difference of four sequences according to a specified key selector function using a provided equality comparer. * @typeparam TSource The type of source elements. * @typeparam TKey The type of key to identify elements by. * @param src The source Iterable * @param second An Iterable whose distinct elements form the second set for the symmetric difference. * @param third An Iterable whose distinct elements form the third set for the symmetric difference. * @param fourth An Iterable whose distinct elements form the fourth set for the symmetric difference. * @param keySelector A function to extract the key for each element. * @param equalityComparer The EqualityComparer to compare values. * @returns An IEnumerable that contains the symmetric difference from all input sequences, excluding duplicates. */ export function xorBy( src: Iterable, second: Iterable, third: Iterable, fourth: Iterable, keySelector: (item: TSource) => TKey, equalityComparer: EqualityComparer ): IEnumerable; export function xorBy( src: Iterable, ...second: (Iterable | ((item: TSource) => TKey) | EqualityComparer)[] ): IEnumerable { return applyXor(new EnumerableFactory(), null, src, second); }