Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import * as faker from 'faker';
import * as _ from 'lodash';
import * as cors from 'cors';
const colorList = [
'#1565c0',
'#5e92f3',
'#003c8f',
'#e91e63',
'#ff6090',
'#b0003a'
];
cors({ origin: true });
export const graphEntities = https.onCall(async (data, context) => {
if (data && data.count) {
const count = data.count;
if (count >= 0 && count <= 5000) {
return await generatedData(count);
} else {
return await generatedData(500);
}
} else {
return await generatedData(1000);
}
});
// use faker to create count random people
// associate them with a color and add to list
function generatedData(count: number) {
const entities = [];