Initialisation
Added the packages and files for the backend server
This commit is contained in:
26
node_modules/graphql/jsutils/groupBy.js
generated
vendored
Normal file
26
node_modules/graphql/jsutils/groupBy.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
'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;
|
||||
}
|
||||
Reference in New Issue
Block a user