Skip to content

Commit

Permalink
Improve orderBy(), orderByDescending()
Browse files Browse the repository at this point in the history
  • Loading branch information
emonkak committed Mar 21, 2018
1 parent b8558ae commit e647b68
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/orderBy.ts
Expand Up @@ -6,5 +6,8 @@ export default function orderBy<TSource, TKey>(this: Iterable<TSource>, keySelec
if (keySelector == null) {
keySelector = value => value as any;
}
if (this instanceof OrderedEnumerable) {
return (this as any).thenBy(keySelector);
}
return new OrderedEnumerable(this, keySelector, false);
}
3 changes: 3 additions & 0 deletions src/orderByDescending.ts
Expand Up @@ -6,5 +6,8 @@ export default function orderByDescending<TSource, TKey>(this: Iterable<TSource>
if (keySelector == null) {
keySelector = value => value as any;
}
if (this instanceof OrderedEnumerable) {
return (this as any).thenByDescending(keySelector);
}
return new OrderedEnumerable(this, keySelector, true);
}

0 comments on commit e647b68

Please sign in to comment.