const randomString = () => Math.random().toString(36).substring(2, 3) + Math.random().toString(36).substring(2, 3); const range = (len: number) => { const arr = []; // eslint-disable-next-line no-plusplus for (let i = 0; i < len; i++) { arr.push(i); } return arr; }; const newLead = (index: number) => ({ index, status: `status${ index }`, date: { time: '12:25', date: '1 Februar, 2020' }, contact: `${ randomString() }test@email.com`, content: `${ randomString() }Some Content here`, source: `${ randomString() }Form Name` }); export const makeMockData = (...lens: any) => { const makeDataLevel = (depth = 0): any => { const len = lens[ depth ]; return range(len).map((d, index) => ({ ...newLead(index), subRows: lens[ depth + 1 ] ? makeDataLevel(depth + 1) : undefined })); }; return makeDataLevel(); };