Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OrderedEnumerable implements IPartition
- Loading branch information
Showing
15 changed files
with
104 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
export const partitionSymbol = Symbol(); | ||
|
||
export function isPartition<T>(source: Iterable<T>): source is IPartition<T> { | ||
return typeof (source as any)[partitionSymbol] === 'function' && | ||
(source as any)[partitionSymbol](); | ||
} | ||
|
||
export interface IPartition<TElement> extends Iterable<TElement> { | ||
[partitionSymbol](): boolean; | ||
|
||
skip(count: number): Iterable<TElement>; | ||
|
||
take(count: number): Iterable<TElement>; | ||
|
||
elementAt(index: number): TElement; | ||
|
||
elementAtOrDefault(index: number): TElement | null; | ||
elementAtOrDefault(index: number, defaultValue: TElement): TElement; | ||
|
||
first(): TElement; | ||
|
||
firstOrDefault(): TElement | null; | ||
firstOrDefault(predicate: null, defaultValue: TElement): TElement; | ||
|
||
last(): TElement; | ||
|
||
lastOrDefault(): TElement | null; | ||
lastOrDefault(predicate: null, defaultValue: TElement): TElement; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.