Created
February 11, 2020 20:08
-
-
Save mattpodwysocki/e496589887efd0b8dab2428f07d85afd to your computer and use it in GitHub Desktop.
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
// 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