'use strict';

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


// src/groupBy.ts
function groupBy(list, keyGetter) {
  const map = /* @__PURE__ */ new Map();
  for (const item of list) {
    const key = keyGetter(item);
    const collection = map.get(key);
    if (collection) {
      collection.push(item);
    } else {
      map.set(key, [item]);
    }
  }
  return map;
}

exports.groupBy = groupBy;
