Relation picker module (#335)
- Created a relation picker module - Added a CustomeEntityForSelect type
This commit is contained in:
@ -1,10 +1,9 @@
|
||||
import { EntityForSelect } from '@/comments/components/MultipleEntitySelect';
|
||||
import { EntityForSelect } from '@/relation-picker/types/EntityForSelect';
|
||||
|
||||
export function flatMapAndSortEntityForSelectArrayOfArrayByName(
|
||||
entityForSelectArray: EntityForSelect[][],
|
||||
) {
|
||||
const sortByName = (a: EntityForSelect, b: EntityForSelect) =>
|
||||
a.name.localeCompare(b.name);
|
||||
export function flatMapAndSortEntityForSelectArrayOfArrayByName<
|
||||
T extends EntityForSelect,
|
||||
>(entityForSelectArray: T[][]) {
|
||||
const sortByName = (a: T, b: T) => a.name.localeCompare(b.name);
|
||||
|
||||
return entityForSelectArray.flatMap((entity) => entity).sort(sortByName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user