'use strict';

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


// src/partition/index.ts
function partition(arr, fn) {
  return arr.reduce((acc, val, i, arr2) => {
    const current = fn(val, i, arr2);
    if (acc.has(current))
      acc.get(current).push(val);
    else
      acc.set(current, [val]);
    return acc;
  }, /* @__PURE__ */ new Map()).values();
}

exports.partition = partition;
