Applies an accumulator function over a sequence.
The final accumulator value.
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value.
The initial accumulator value.
An accumulator function to be invoked on each element.
The final accumulator value.
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.
The initial accumulator value.
An accumulator function to be invoked on each element.
An accumulator function to be invoked on each element.
The final accumulator value.
Determines whether all elements of a sequence satisfy a condition.
A function to test each element for a condition.
true if every element of the source sequence passes the test in the specified predicate, or if the sequence is empty; otherwise, false.
Determines whether any element of a sequence exists or satisfies a condition.
true if the source sequence contains any elements (or if at least one matches condition if condition is passed); otherwise, false.
Determines whether any element of a sequence exists or satisfies a condition.
A function to test each element for a condition.
true if the source sequence contains any elements (or if at least one matches condition if condition is passed); otherwise, false.
Appends a value to the end of the sequence.
The value to append.
A new sequence that ends with element.
Returns the input as an IEnumerable.
The input sequence as IEnumerable.
Tests a sequence with a given predicate. An error will be thrown if any element fails the sequence.
A function to test each element for a condition. If false, an error will be thrown.
A sequence with source elements in their original order.
Tests a sequence with a given predicate. An error will be thrown if any element fails the sequence.
A function to test each element for a condition. If false, an error will be thrown.
The message to use for thrown errors.
A sequence with source elements in their original order.
Tests a sequence with a given predicate. An error will be thrown if any element fails the sequence.
A sequence with source elements in their original order.
Tests a sequence with a given predicate. An error will be thrown if any element fails the sequence.
A sequence with source elements in their original order.
Determines whether or not the number of elements in the sequence is greater than or equal to the given integer.
The minimum number of items a sequence must have for this function to return true
true if the number of elements in the sequence is greater than or equal to the given integer or false otherwise.
Determines whether or not the number of elements in the sequence is greater than or equal to the given integer.
The minimum number of items a sequence must have for this function to return true
A function to test each element for a condition.
true if the number of elements in the sequence is greater than or equal to the given integer or false otherwise.
Determines whether or not the number of elements in the sequence is lesser than or equal to the given integer.
The maximun number of items a sequence must have for this function to return true.
true if the number of elements in the sequence is lesser than or equal to the given integer or false otherwise.
Determines whether or not the number of elements that match the predicate in the sequence is lesser than or equal to the given integer.
The maximun number of items a sequence must have for this function to return true.
The condition to match the elements by.
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.
Computes the average of a sequence of numeric values.
The average of the sequence of values.
Computes the average of a sequence of numeric values.
A transform function to apply to each element.
The average of the sequence of values.
Split the elements of a sequence into chunks of size at most chunkSize.
The maximum size of each chunk.
An IEnumerable
Concatenates two sequences.
The sequence to concatenate to the first sequence.
An IEnumerable
Concatenates two or more sequences.
The sequences to concatenate to the first sequence.
An IEnumerable
Determines whether a sequence contains a specified element.
The value to locate in the sequence.
true if the source sequence contains an element that has the specified value; otherwise, false.
Determines whether a sequence contains a specified element.
The value to locate in the sequence.
An equality comparer to compare values.
true if the source sequence contains an element that has the specified value; otherwise, false.
Returns the number of elements in a sequence.
The number of elements in the input sequence.
Returns the number of elements in a sequence.
A function to test each element for a condition.
The number of elements in the input sequence.
Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty.
The value to return if the sequence is empty.
An IEnumerable
Returns distinct elements from a sequence.
An IEnumerable
Returns distinct elements from a sequence.
An EqualityComparer
An IEnumerable
Returns distinct elements from a sequence according to a specified key selector function.
An IEnumerable
Returns distinct elements from a sequence according to a specified key selector function.
A function to extract the key for each element.
An EqualityComparer
An IEnumerable
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.
The zero-based index of the element to retrieve.
The element at the specified position in the source sequence.
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.
The zero-based index of the element to retrieve.
The element at the specified position in the source sequence.
Determines whether the end of the first sequence is equivalent to the second sequence.
The sequence to compare to.
true if first ends with elements equivalent to second.
Determines whether the end of the first sequence is equivalent to the second sequence, using the specified element equality comparer.
The sequence to compare to.
Equality comparer to use.
true if first ends with elements equivalent to second.
Produces the set difference of two sequences.
An Iterable
A sequence that contains the set difference of the elements of two sequences.
Produces the set difference of two sequences.
An Iterable
A sequence that contains the set difference of the elements of two sequences.
Produces the set difference of two sequences.
An Iterable
An EqualityComparer
A sequence that contains the set difference of the elements of two sequences.
Produces the set difference of two sequences.
An Iterable
An Iterable
An EqualityComparer
A sequence that contains the set difference of the elements of two sequences.
Produces the set difference of two sequences.
An Iterable
An Iterable
An Iterable
An EqualityComparer
A sequence that contains the set difference of the elements of two sequences.
Produces the set difference of two sequences according to a specified key selector function.
A sequence that contains the set difference of the elements of two sequences.
Produces the set difference of two sequences according to a specified key selector function.
An Iterable
An Iterable
A function to extract the key for each element.
A sequence that contains the set difference of the elements of two sequences.
Produces the set difference of two sequences according to a specified key selector function.
An Iterable
An Iterable
An Iterable
A function to extract the key for each element.
A sequence that contains the set difference of the elements of two sequences.
Produces the set difference of two sequences according to a specified key selector function.
An Iterable
A function to extract the key for each element.
An EqualityComparer
A sequence that contains the set difference of the elements of two sequences.
Produces the set difference of two sequences according to a specified key selector function.
An Iterable
A function to extract the key for each element.
An EqualityComparer
A sequence that contains the set difference of the elements of two sequences.
Produces the set difference of two sequences according to a specified key selector function.
An Iterable
An Iterable
A function to extract the key for each element.
An EqualityComparer
A sequence that contains the set difference of the elements of two sequences.
Returns the first element in a sequence. Throws if sequence contains no elements.
The first element in the sequence.
Returns the first element in a sequence that satisfies a specified condition. Throws if sequence contains no elements that matches condition.
A function to test each element for a condition.
The first element in the sequence that passes the test in the specified predicate function.
Returns the first element in a sequence. Returns null if sequence contains no elements.
The first element in the sequence or null.
Returns the first element in a sequence that satisfies a specified condition. Returns null if sequence contains no elements that matches condition.
A function to test each element for a condition.
The first element in the sequence that passes the test in the specified predicate function or null.
Returns a new IEnumerable with all sub-iterable elements concatenated into it one level deep.
A new IEnumerable with all sub-iterable elements concatenated into it recursively up.
Returns a new IEnumerable with all sub-iterable elements concatenated into it recursively up to the specified depth.
The depth to flatten to.
A new IEnumerable with all sub-iterable elements concatenated into it recursively up.
Performs a full outer join on two heterogeneous sequences. Additional arguments specify key selection functions, result projection functions and a key comparer.
The second sequence of the join operation.
Function that projects the key given an element from first.
Function that projects the key given an element from second.
Function that projects the result given just an element from second where there is no corresponding element in first.
Function that projects the result given an element from first and an element from second that match on a common key.
A sequence containing results projected from a right outer join of the two input sequences.
Performs a full outer join on two heterogeneous sequences. Additional arguments specify key selection functions, result projection functions and a key comparer.
The second sequence of the join operation.
Function that projects the key given an element from first.
Function that projects the key given an element from second.
Function that projects the result given just an element from second where there is no corresponding element in first.
Function that projects the result given an element from first and an element from second that match on a common key.
A function to compare keys.
A sequence containing results projected from a right outer join of the two input sequences.
Performs a full outer join on two homogeneous sequences. Additional arguments specify key selection functions and result projection functions.
The second sequence of the join operation.
Function that projects the key given an element of one of the sequences to join.
Function that projects the result given just an element from first where there is no corresponding element in second.
Function that projects the result given just an element from second where there is no corresponding element in first.
Function that projects the result given an element from first and an element from second that match on a common key.
A sequence containing results projected from a full outer join of the two input sequences.
Performs a full outer join on two homogeneous sequences. Additional arguments specify key selection functions and result projection functions.
The second sequence of the join operation.
Function that projects the key given an element of one of the sequences to join.
Function that projects the result given just an element from first where there is no corresponding element in second.
Function that projects the result given just an element from second where there is no corresponding element in first.
Function that projects the result given an element from first and an element from second that match on a common key.
A function to compare keys.
A sequence containing results projected from a full outer join of the two input sequences.
Groups the elements of a sequence according to a specified key selector function.
An IEnumerable<IGrouping<TKey, TSource>> where each IGrouping<TKey, TSource> object contains a sequence of objects and a key.
Groups the elements of a sequence according to a specified key selector function.
A function to extract the key for each element.
A function to compare keys.
An IEnumerable<IGrouping<TKey, TSource>> where each IGrouping<TKey, TSource> object contains a sequence of objects and a key.
Correlates the elements of two sequences based on key equality, and groups the results.
The sequence to join to the first sequence.
A function to extract the join key from each element of the first sequence.
A function to extract the join key from each element of the second sequence.
A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence.
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: [] }
]);
Correlates the elements of two sequences based on key equality, and groups the results.
The sequence to join to the first sequence.
A function to extract the join key from each element of the first sequence.
A function to extract the join key from each element of the second sequence.
A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence.
An IEnumerable
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: [] }
]);
Performs an inner join by correlating the elements of two sequences based on matching keys.
The second sequence to join to the first.
A function to extract the join key from each element of the first sequence.
A function to extract the join key from each element of the second sequence.
A function to create a result element from two matching elements.
An IEnumerable
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' }
]);
Performs an inner join by correlating the elements of two sequences based on matching keys.
The second sequence to join to the first.
A function to extract the join key from each element of the first sequence.
A function to extract the join key from each element of the second sequence.
A function to create a result element from two matching elements.
A function to compare keys.
An IEnumerable
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' }
]);
Produces the set intersection of two sequences.
An IEnumerable
A sequence that contains the elements that form the set intersection of two sequences.
Produces the set intersection of two sequences.
An IEnumerable
A sequence that contains the elements that form the set intersection of two sequences.
Produces the set intersection of two sequences.
An IEnumerable
A function to compare keys.
A sequence that contains the elements that form the set intersection of two sequences.
Produces the set intersection of two sequences.
An IEnumerable
An IEnumerable
A function to compare keys.
A sequence that contains the elements that form the set intersection of two sequences.
Produces the set intersection of two sequences.
An IEnumerable
An IEnumerable
An IEnumerable
A function to compare keys.
A sequence that contains the elements that form the set intersection of two sequences.
Produces the set intersection of two sequences according to a specified key selector function.
A sequence that contains the elements that form the set intersection of two sequences.
Produces the set intersection of two sequences according to a specified key selector function.
An IEnumerable
An IEnumerable
A function to extract the key for each element.
A sequence that contains the elements that form the set intersection of two sequences.
Produces the set intersection of two sequences according to a specified key selector function.
An IEnumerable
An IEnumerable
An IEnumerable
A function to extract the key for each element.
A sequence that contains the elements that form the set intersection of two sequences.
Produces the set intersection of two sequences according to a specified key selector function.
An IEnumerable
A function to extract the key for each element.
A function to compare keys.
A sequence that contains the elements that form the set intersection of two sequences.
Produces the set intersection of two sequences according to a specified key selector function.
An IEnumerable
An IEnumerable
A function to extract the key for each element.
A function to compare keys.
A sequence that contains the elements that form the set intersection of two sequences.
Produces the set intersection of two sequences according to a specified key selector function.
An IEnumerable
An IEnumerable
An IEnumerable
A function to extract the key for each element.
A function to compare keys.
A sequence that contains the elements that form the set intersection of two sequences.
Interweaves two sequences.
The sequence to interweave to the first sequence.
An IEnumerable
Interweaves multiple sequences.
The sequences to interweave to the first sequence.
An IEnumerable
Returns the last element of a sequence. Throws if sequence is empty.
The value at the last position in the source sequence.
Returns the last element of a sequence that satisfies a specified condition.
A function to test each element for a condition.
The last element in the sequence that passes the test in the specified predicate function.
Returns the last element of a sequence, or null if the sequence contains no elements.
null if the source sequence is empty; otherwise, the last element in the IEnumerable
Returns the last element of a sequence that satisfies a condition or null if no such element is found.
A function to test each element for a condition.
null if the sequence is empty or if no elements pass the test in the predicate function; otherwise, the last element that passes the test in the predicate function.
Performs a left outer join on two heterogeneous sequences. Additional arguments specify key selection functions and result projection functions.
The second sequence of the join operation.
Function that projects the key given an element from first.
Function that projects the key given an element from second.
Function that projects the result given just an element from first where there is no corresponding element in second.
Function that projects the result given an element from first and an element from second that match on a common key.
A sequence containing results projected from a left outer join of the two input sequences.
Performs a left outer join on two heterogeneous sequences. Additional arguments specify key selection functions and result projection functions.
The second sequence of the join operation.
Function that projects the key given an element from first.
Function that projects the key given an element from second.
Function that projects the result given just an element from first where there is no corresponding element in second.
Function that projects the result given an element from first and an element from second that match on a common key.
A function to compare keys.
A sequence containing results projected from a left outer join of the two input sequences.
Performs a left outer join on two homogeneous sequences. Additional arguments specify key selection functions and result projection functions.
The second sequence of the join operation.
Function that projects the key given an element of one of the sequences to join.
Function that projects the result given just an element from first where there is no corresponding element in second.
Function that projects the result given an element from first and an element from second that match on a common key.
A sequence containing results projected from a left outer join of the two input sequences.
Performs a left outer join on two homogeneous sequences. Additional arguments specify key selection functions and result projection functions.
The second sequence of the join operation.
Function that projects the key given an element of one of the sequences to join.
Function that projects the result given just an element from first where there is no corresponding element in second.
Function that projects the result given an element from first and an element from second that match on a common key.
A function to compare keys.
A sequence containing results projected from a left outer join of the two input sequences.
Returns the maximum value in a sequence of values.
The max value in the sequence.
Invokes a transform function on each element of a generic sequence and returns the maximum resulting value.
The maximum value in the sequence.
Returns the min value in a sequence of values.
The min value in the sequence.
Invokes a transform function on each element of a generic sequence and returns the min resulting value.
The min value in the sequence.
Filters the elements of an IEnumerable based on a specified type.
The type to filter the elements of the sequence on.
An IEnumerable
Sorts the elements of a sequence in ascending order.
An IOrderedEnumerable
Sorts the elements of a sequence in ascending order.
An IOrderedEnumerable
Sorts the elements of a sequence in ascending order.
An IOrderedEnumerable
Sorts the elements of a sequence in ascending order.
An IOrderedEnumerable
Sorts the elements of a sequence in descending order.
An IOrderedEnumerable
Sorts the elements of a sequence in descending order.
An IOrderedEnumerable
Sorts the elements of a sequence in descending order.
An IOrderedEnumerable
Sorts the elements of a sequence in descending order.
An IOrderedEnumerable
Executes the given action on each element in the source sequence and yields it.
The action to execute on each element.
A sequence with source elements in their original order.
Adds a value to the beginning of the sequence.
The value to prepend to source.
A new sequence that begins with item.
Computes the quantile of a sequence of numbers. Note this will throw an exception if sequence has something other than numbers.
The percentile to compute (25, 50, etc.)
The percentile of the sequence.
Computes the quantile of a sequence.
A function to extract a value from each element.
The percentile to compute (25, 50, etc.)
The percentile of the sequence.
Inverts the order of the elements in a sequence.
A sequence whose elements correspond to those of the input sequence in reverse order.
Performs a right outer join on two heterogeneous sequences.
The second sequence of the join operation.
Function that projects the key given an element from first.
Function that projects the key given an element from second.
Function that projects the result given just an element from second where there is no corresponding element in first.
Function that projects the result given an element from first and an element from second that match on a common key.
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'.
]);
Performs a right outer join on two heterogeneous sequences.
The second sequence of the join operation.
Function that projects the key given an element from first.
Function that projects the key given an element from second.
Function that projects the result given just an element from second where there is no corresponding element in first.
Function that projects the result given an element from first and an element from second that match on a common key.
A function to compare keys.
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'.
]);
Performs a right outer join on two homogeneous sequences.
The second sequence of the join operation.
Function that projects the key given an element of one of the sequences to join.
Function that projects the result given just an element from second where there is no corresponding element in first.
Function that projects the result given an element from first and an element from second that match on a common key.
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 }
]);
Performs a right outer join on two homogeneous sequences.
The second sequence of the join operation.
Function that projects the key given an element of one of the sequences to join.
Function that projects the result given just an element from second where there is no corresponding element in first.
Function that projects the result given an element from first and an element from second that match on a common key.
A function to compare keys.
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 }
]);
Projects each element of a sequence into a new form.
An IEnumerable
Projects each element of a sequence to an IEnumerable
An IEnumerable
Determines whether two sequences are equal by comparing the elements.
An IEnumerable
true if the two source sequences are of equal length and their corresponding elements are equal; otherwise, false.
Determines whether two sequences are equal by comparing their elements by using a specified EqualityComparer
An IEnumerable
An EqualityComparer
true if the two source sequences are of equal length and their corresponding elements compare equal according to equalityComparer; otherwise, false.
Returns a new IEnumerable
A new IEnumerable
Returns the first element of a sequence, and throws an exception if more than one element exists.
The single element of the input sequence that satisfies a condition.
Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists.
A function to test an element for a condition.
The single element of the input sequence that satisfies a condition.
Returns a single, specific element of a sequence, or null if that element is not found.
The single element of the input sequence, or null if the sequence contains no elements.
Returns the only element of a sequence that satisfies a specified condition or null if no such element exists; this method throws an exception if more than one element satisfies the condition.
A function to test an element for a condition.
The single element of the input sequence that satisfies the condition, or null if no such element is found.
Bypasses a specified number of elements in a sequence and then returns the remaining elements.
The number of elements to skip before returning the remaining elements.
An IEnumerable
Returns a new enumerable collection that contains the elements from source with the last count elements of the source collection omitted.
The number of elements to omit from the end of the collection.
A new enumerable collection that contains the elements from source minus count elements from the end of the collection.
Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.
A function to test each source element for a condition; the second parameter of the function represents the index of the source element.
An IEnumerable
Splits the source sequence by a separator.
Separator element.
A sequence of splits of elements.
Splits the source sequence by a predicate.
A function to test an element for a condition.
A sequence of splits of elements.
Determines whether the beginning of the first sequence is equivalent to the second sequence.
The sequence to compare to.
true if first begins with elements equivalent to second.
Determines whether the beginning of the first sequence is equivalent to the second sequence, using the specified element equality comparer.
The sequence to compare to.
Equality comparer to use.
true if first begins with elements equivalent to second.
Computes the sum of a sequence of numeric values.
The sum of the values in the sequence.
Computes the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence.
A transform function to apply to each element.
The sum of the projected values.
Returns a specified number of contiguous elements from the start of a sequence.
An IEnumerable
Returns every N-th element of a sequence.
Number of elements to bypass before returning the next element.
A sequence with every N-th element of the input sequence.
Returns a new enumerable collection that contains the last count elements from source.
The number of elements to take from the end of the collection.
A new enumerable collection that contains the last count elements from source.
Returns elements from a sequence as long as a specified condition is true, and then skips the remaining elements.
A function to test each source element for a condition; the second parameter of the function represents the index of the source element.
An IEnumerable
Creates a Map<TKey, TValue> from an IEnumerable
A Map<TKey, TSource> that contains keys and values.
Creates a Map<TKey, TValue> from an IEnumerable
A Map<TKey, TValue> that contains keys and values.
Returns an object with keys selected by keySelector and values of TSource.
A function to extract a key from each element.
An object with keys selected by keySelector and values of TSource
Returns an object with keys selected by keySelector and values of TSource.
An object with keys selected by keySelector and values of TSource
Produces the set union of two sequences.
An Iterable
An IEnumerable
Produces the set union of two sequences.
One or more Iterable
An IEnumerable
Produces the set union of two sequences.
An IEnumerable
The EqualityComparer
An IEnumerable
Produces the set union of two sequences.
An IEnumerable
An IEnumerable
The EqualityComparer
An IEnumerable
Produces the set union of two sequences.
An IEnumerable
An IEnumerable
An IEnumerable
The EqualityComparer
An IEnumerable
Produces the set union of two sequences according to a specified key selector function.
An IEnumerable
Produces the set union of two sequences according to a specified key selector function.
An IEnumerable
Produces the set union of two sequences according to a specified key selector function.
An IEnumerable
An IEnumerable
An IEnumerable
A function to extract the key for each element.
An IEnumerable
Produces the set union of two sequences according to a specified key selector function.
An IEnumerable
A function to extract the key for each element.
The EqualityComparer
An IEnumerable
Produces the set union of two sequences according to a specified key selector function.
An IEnumerable
An IEnumerable
A function to extract the key for each element.
The EqualityComparer
An IEnumerable
Produces the set union of two sequences according to a specified key selector function.
An IEnumerable
An IEnumerable
An IEnumerable
A function to extract the key for each element.
The EqualityComparer
An IEnumerable
Filters a sequence of values based on a predicate.
A function to test each source element for a condition; the second parameter of the function represents the index of the source element.
An IEnumerable
Processes a sequence into a series of subsequences representing a windowed subset of the original. If size is greater than source.length, no subsequences will be returned.
The size (number of elements) in each window.
A series of sequences representing each sliding window subsequence.
Produces the set union of two sequences.
One or more Iterable
An IEnumerable
Produces the symmetric difference of two or more sequences.
One or more Iterable
An IEnumerable
Produces the symmetric difference of two sequences using a provided equality comparer.
An Iterable
The EqualityComparer
An IEnumerable
Produces the symmetric difference of three sequences using a provided equality comparer.
An Iterable
An Iterable
The EqualityComparer
An IEnumerable
Produces the symmetric difference of four sequences using a provided equality comparer.
An Iterable
An Iterable
An Iterable
The EqualityComparer
An IEnumerable
Produces the symmetric difference of two sequences according to a specified key selector function.
An IEnumerable
Produces the symmetric difference of three sequences according to a specified key selector function.
An Iterable
An Iterable
A function to extract the key for each element.
An IEnumerable
Produces the symmetric difference of four sequences according to a specified key selector function.
An Iterable
An Iterable
An Iterable
A function to extract the key for each element.
An IEnumerable
Produces the symmetric difference of two sequences according to a specified key selector function using a provided equality comparer.
An Iterable
A function to extract the key for each element.
The EqualityComparer
An IEnumerable
Produces the symmetric difference of three sequences according to a specified key selector function using a provided equality comparer.
An Iterable
An Iterable
A function to extract the key for each element.
The EqualityComparer
An IEnumerable
Produces the symmetric difference of four sequences according to a specified key selector function using a provided equality comparer.
An Iterable
An Iterable
An Iterable
A function to extract the key for each element.
The EqualityComparer
An IEnumerable
Produces a sequence of tuples with elements from the two specified sequences.
The second sequence to merge.
An IEnumerable<[TSource, TSecond]> that contains merged elements of two input sequences.
Applies a specified function to the corresponding elements of two sequences, producing a sequence of the results.
An IEnumerable
Interface that exposes an iterator, which supports a simple iteration and various methods.
Typeparam
TSource The type of elements in the IEnumerable.