Next.js template
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sortHelpers.js 244B

1234567891011
  1. export const compare = (a, b, sort) => {
  2. if (sort === 'asc') {
  3. if (a > b) return 1;
  4. else if (b > a) return -1;
  5. return 0;
  6. } else if (sort === 'desc') {
  7. if (a > b) return -1;
  8. else if (b > a) return 1;
  9. return 0;
  10. }
  11. };