You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use Object.create(null) to avoid having to check if xyz is an array using Array.isArray
allow using a 3th argument as a destination object that defaults to an object. (incase you need to use the same object for more stuff)
use ??= assignment to clamp it down even more
functiongroupBy(iterable,cb,dest=Object.create(null)){if(typeofcb!=='function')thrownewError('expected a function for second argument')if(typeofdest!=='object')thrownewError('expected a object for third argument')for(varitemofiterable)(dest[cb(item)]??=[]).push(item)returndest}
The text was updated successfully, but these errors were encountered:
Object.create(null)
to avoid having to check if xyz is an array using Array.isArray??=
assignment to clamp it down even moreThe text was updated successfully, but these errors were encountered: