JavaScript Object.groupBy returns a null-prototype object: "TypeError: Object.groupBy(...).hasOwnProperty is not a function"
Object.groupBy(items, fn) returns an object with a null prototype (so group names like toString or __proto__ cannot collide with inherited properties). Code that treats it as a normal object breaks: groups.hasOwnProperty('a') throws TypeError: Object.groupBy(...).hasOwnProperty is not a function, interpolating it in a template string throws TypeError: Cannot convert object to primitive value, and console.log shows [Object: null prototype] { a: [ 1 ] }. Some libraries and deep-equal helpers that expect Object.prototype also mis-handle it. Fix: use Object.hasOwn(groups, key) or key in groups, iterate with Object.entries, spread into {...groups} when a normal object is needed, or use Map.groupBy for non-string keys. Node v26.7.0 (V8) vs Bun 1.3.14.