/**
 * Page display order
 */
export enum Order {
    /**
     * Ascending order
     */
    ASC = 'asc',
    
    /**
     * Descending order
     */
    DESC = 'desc',
}

/**
 * Converts string value to appropriate enum-member
 * @param str String to be converted
 * @returns Appropriate enum-member
 */
export function toOrder(str: string): Order {
    if (!str) return Order.DESC;

    switch (str) {
        case 'asc': return Order.ASC;
        case 'desc': return Order.DESC;
    }
    return;
}