All files / utils sort-order.ts

100% Statements 13/13
100% Branches 3/3
100% Functions 2/2
100% Lines 12/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 202x 4x 4x   4x 4x 2x 2x 2x   4x   2x   2x       2x  
const sortByAlphabet = (a, b) => {
    const title1 = a;
    const title2 = b;
 
    let comparison = 0;
    if (title1 > title2) {
        comparison = 1;
    } else if (title1 < title2) {
        comparison = -1;
    }
    return comparison;
};
const sortByDate = (a, b) => {
    {
        return new Date(b).getTime() - new Date(a).getTime();
    }
};
 
export { sortByAlphabet, sortByDate };