Odoo GraphQL Subscription using Node, Express JS for Sample
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

26 lines
477 B

'use strict';
Object.defineProperty(exports, '__esModule', {
value: true,
});
exports.groupBy = groupBy;
/**
* Groups array items into a Map, given a function to produce grouping key.
*/
function groupBy(list, keyFn) {
const result = new Map();
for (const item of list) {
const key = keyFn(item);
const group = result.get(key);
if (group === undefined) {
result.set(key, [item]);
} else {
group.push(item);
}
}
return result;
}