UNPKG

swarpc

Version:

Full type-safe RPC library for service worker -- move things off of the UI thread with ease!

11 lines (10 loc) 293 B
Map.groupBy ??= function groupBy(iterable, callbackfn) { const map = new Map(); let i = 0; for (const value of iterable) { const key = callbackfn(value, i++), list = map.get(key); list ? list.push(value) : map.set(key, [value]); } return map; }; export {};