mirror of
https://github.com/gosticks/react-table.git
synced 2026-08-19 08:20:30 +00:00
36 lines
773 B
JavaScript
36 lines
773 B
JavaScript
import namor from "namor";
|
|
|
|
const range = len => {
|
|
const arr = [];
|
|
for (let i = 0; i < len; i++) {
|
|
arr.push(i);
|
|
}
|
|
return arr;
|
|
};
|
|
|
|
const newPerson = () => {
|
|
const statusChance = Math.random();
|
|
return {
|
|
firstName: namor.generate({ words: 1, numbers: 0 }),
|
|
lastName: namor.generate({ words: 1, numbers: 0 }),
|
|
age: Math.floor(Math.random() * 30),
|
|
visits: Math.floor(Math.random() * 100),
|
|
progress: Math.floor(Math.random() * 100),
|
|
status:
|
|
statusChance > 0.66
|
|
? "relationship"
|
|
: statusChance > 0.33
|
|
? "complicated"
|
|
: "single"
|
|
};
|
|
};
|
|
|
|
export function makeData(len = 5553) {
|
|
return range(len).map(d => {
|
|
return {
|
|
...newPerson(),
|
|
children: range(10).map(newPerson)
|
|
};
|
|
});
|
|
}
|