2023-01-03 19:55:46 +00:00
|
|
|
// Copyright 2020 Signal Messenger, LLC
|
2020-12-03 17:24:44 +00:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2021-01-14 18:07:05 +00:00
|
|
|
type HasTitle = {
|
2020-12-03 17:24:44 +00:00
|
|
|
title: string;
|
2021-01-14 18:07:05 +00:00
|
|
|
};
|
2020-12-03 17:24:44 +00:00
|
|
|
|
|
|
|
export function sortByTitle<T extends HasTitle>(
|
|
|
|
arr: ReadonlyArray<T>
|
|
|
|
): Array<T> {
|
|
|
|
return [...arr].sort((a, b) => a.title.localeCompare(b.title));
|
|
|
|
}
|