import { moveElementInArray } from '@utils/functions';
import { UserService } from '@users/user.service';

export function sortArray(array: string[], numeric = false) {
    array.sort((a: string, b: string) => a.localeCompare(b, undefined, { numeric: numeric }));
    if (array.includes(undefined)) {
        array = moveElementInArray(array, undefined, 0);
    }
    return array;
}
export function sortByName(userService: UserService, ids: string[]) {
    return ids.sort((a, b) => userService.getName(a).localeCompare(userService.getName(b)));
}
