Fix mutation in CallingParticipantList component
This commit is contained in:
12
ts/util/sortByTitle.ts
Normal file
12
ts/util/sortByTitle.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright 2020 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
interface HasTitle {
|
||||
title: string;
|
||||
}
|
||||
|
||||
export function sortByTitle<T extends HasTitle>(
|
||||
arr: ReadonlyArray<T>
|
||||
): Array<T> {
|
||||
return [...arr].sort((a, b) => a.title.localeCompare(b.title));
|
||||
}
|
Reference in New Issue
Block a user