'use strict';

/*!
 * @techmely/utils
 * Copyright(c) 2021-2024 Techmely <techmely.creation@gmail.com>
 * MIT Licensed
 */


// src/sortByKey.ts
var SortDirection = /* @__PURE__ */ ((SortDirection2) => {
  SortDirection2["ASC"] = "ASC";
  SortDirection2["DESC"] = "DESC";
  return SortDirection2;
})(SortDirection || {});
function sortByDate(a, b, key, direction = "ASC" /* ASC */) {
  if (a[key] < b[key]) {
    return direction === "ASC" /* ASC */ ? 1 : -1;
  }
  if (a[key] > b[key]) {
    return direction === "ASC" /* ASC */ ? -1 : 1;
  }
  return 0;
}

exports.SortDirection = SortDirection;
exports.sortByDate = sortByDate;
