riku
2025-11-05 08ffcf9d7ffafaa82d8de7f9b5fcfdb49e9c3688
src/utils/expand/expand.js
@@ -30,3 +30,18 @@
  const s = size > this.length ? 0 : this.length - size;
  return this.slice(s, l);
};
Array.prototype.groupBy = function (func) {
  const groups = {};
  this.forEach((item) => {
    const key = func(item);
    if (!groups[key]) {
      groups[key] = [];
    }
    groups[key].push(item);
  });
  return Object.keys(groups).map((key) => ({
    key,
    values: groups[key]
  }));
};