Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mattpodwysocki
Created February 11, 2020 20:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattpodwysocki/e496589887efd0b8dab2428f07d85afd to your computer and use it in GitHub Desktop.
Save mattpodwysocki/e496589887efd0b8dab2428f07d85afd to your computer and use it in GitHub Desktop.
// New Way
export function orderBy<TSource>(
key: keyof TSource
): UnaryFunction<AsyncIterable<TSource>, OrderedAsyncIterableX<TKey, TSource>> {
return function orderByOperatorFunction(source: AsyncIterable<TSource>) {
return new OrderedAsyncIterableX<TSource>(source, key, false);
};
}
// Old way
export function orderBy<TKey, TSource>(
keySelector: (item: TSource) => TKey,
comparer: (fst: TKey, snd: TKey) => number = defaultSorter
): UnaryFunction<AsyncIterable<TSource>, OrderedAsyncIterableX<TKey, TSource>> {
return function orderByOperatorFunction(source: AsyncIterable<TSource>) {
return new OrderedAsyncIterableX<TKey, TSource>(source, keySelector, comparer, false);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment