mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-06 04:52:21 -07:00
(cherry picked from commit 1a1c8e6c08a6db5fcd2b5d17e65fa1f943d2e746) Closes #4912 Closes #4921
13 lines
351 B
TypeScript
13 lines
351 B
TypeScript
import { StringKey } from 'typings/Helpers/KeysMatching';
|
|
|
|
export function sortByProp<
|
|
// eslint-disable-next-line no-use-before-define
|
|
T extends Record<K, string>,
|
|
K extends StringKey<T>
|
|
>(sortKey: K) {
|
|
return (a: T, b: T) => {
|
|
return a[sortKey].localeCompare(b[sortKey], undefined, { numeric: true });
|
|
};
|
|
}
|
|
|
|
export default sortByProp;
|