aboutsummaryrefslogtreecommitdiff
path: root/src/utils/array.ts
blob: 15b3506dc79492f8475fb936ecd526f7f1a02f07 (plain) (blame)
1
2
3
4
5
6
7
export { byOrder };

function byOrder({ order }: { order: 'asc' | 'desc' | null | undefined }) {
  return (a: string, b: string) => {
    return order === 'asc' ? a.localeCompare(b) : b.localeCompare(a);
  };
}