import { Parent } from './types'; export const generateArray = (length: number, ids: Array = []): Array => { const data = Array(length - ids.length).fill(0).map( (_, id) => ({ id: id.toString(), int: Math.floor(Math.random() * 100000), color: `#${Math.floor(Math.random()*16777215).toString(16)}`, float: Math.random().toFixed(18), child: { id: Math.floor(Math.random() * 10000).toString(), color: `#${Math.floor(Math.random()*16777215).toString(16)}` } }) ); for (const id of ids) { data.push({ id: id, int: Math.floor(Math.random() * 100000), color: `#${Math.floor(Math.random()*16777215).toString(16)}`, float: Math.random().toFixed(18), child: { id: Math.floor(Math.random() * 10000).toString(), color: `#${Math.floor(Math.random()*16777215).toString(16)}` } }) } return data; };