import { __exports as array } from '../../../../../../../_virtual/array.mjs';

Object.defineProperty(array, "__esModule", {
  value: true
});
array.splitWhen = array.flatten = void 0;
function flatten(items) {
  return items.reduce((collection, item) => [].concat(collection, item), []);
}
array.flatten = flatten;
function splitWhen(items, predicate) {
  const result = [[]];
  let groupIndex = 0;
  for (const item of items) {
    if (predicate(item)) {
      groupIndex++;
      result[groupIndex] = [];
    } else {
      result[groupIndex].push(item);
    }
  }
  return result;
}
array.splitWhen = splitWhen;

export { array as default };
