# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] ### Added - Multi-key `groupBy` via string/accessor arrays (e.g. `['country', 'status']`) - `.toArray()` to export groups as `[{ key, items, …aggregates }]` - `.count(alias)` and single-pass `.aggregate(spec)` - `.reduce(alias, reducer, initial?)` for custom per-group folds - `.orderBy(field, direction?)` to sort groups by key, alias, or function - `.omitItems()` to drop raw `items` after aggregation (call last) - Column accessors: string field or `(item) => value` for nested/derived values - TypeScript declarations (`index.d.ts` / `index.d.mts`) - ESM entry (`index.mjs`) with dual `package.json` `"exports"` for `import` and `require` - Informal `npm run bench` benchmark script - GitHub Actions CI on pull requests (Node 18 / 20 / 22) - `groupBy(data, key, { strict: true })` to restore missing-key throws - `aggregate()` accepts a list of entries per op (e.g. two `sum`s in one scan) ### Fixed - `keys`, `firstGroup`, and `lastGroup` are live (reflect `.where()`) - Empty groups are removed after `.where()`; aggregates guard empty `items` - Safe `hasOwnProperty` for `Object.create(null)` rows - `min` / `max` no longer risk stack overflow on large groups - `distinctCount` is O(n) via `Set` - Empty arrays return an empty result instead of throwing - Missing grouping keys group under `"undefined"` instead of throwing (use `{ strict: true }` for the old behavior) - `sum` / `avg` / `min` / `max` skip `null`, `undefined`, `''`, and non-finite values instead of producing `NaN` ### Changed - README rewritten with real-world recipes (sales, logs, inventory) and an `Object.groupBy` comparison - Publish workflow uses npm Trusted Publishing (OIDC) on Node 24; no `NPM_TOKEN` - Fixtures directory renamed from `fixures` to `fixtures` ## [2.0.1] - 2024 ### Fixed - README and packaging tweaks after 2.0.0 ## [2.0.0] - 2024 ### Changed - Breaking API refinements (see release commit history) ## [1.2.3] - 2022 ### Fixed - Patch release via automated version bump ## [1.2.0] - 2022 ### Added - Initial published aggregation helpers (`sum`, `avg`, `min`, `max`, `distinctCount`, `where`) [Unreleased]: https://github.com/juli04guilar/groupBy/compare/v2.0.1...HEAD [2.0.1]: https://github.com/juli04guilar/groupBy/compare/v2.0.0...v2.0.1 [2.0.0]: https://github.com/juli04guilar/groupBy/compare/v1.2.3...v2.0.0 [1.2.3]: https://github.com/juli04guilar/groupBy/compare/v1.2.0...v1.2.3 [1.2.0]: https://github.com/juli04guilar/groupBy/releases/tag/v1.2.0