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