data.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. let ID = 1
  2. function _random(max: number) {
  3. return Math.round(Math.random() * 1000) % max
  4. }
  5. export function buildData(count = 1000) {
  6. const adjectives = [
  7. 'pretty',
  8. 'large',
  9. 'big',
  10. 'small',
  11. 'tall',
  12. 'short',
  13. 'long',
  14. 'handsome',
  15. 'plain',
  16. 'quaint',
  17. 'clean',
  18. 'elegant',
  19. 'easy',
  20. 'angry',
  21. 'crazy',
  22. 'helpful',
  23. 'mushy',
  24. 'odd',
  25. 'unsightly',
  26. 'adorable',
  27. 'important',
  28. 'inexpensive',
  29. 'cheap',
  30. 'expensive',
  31. 'fancy',
  32. ]
  33. const colours = [
  34. 'red',
  35. 'yellow',
  36. 'blue',
  37. 'green',
  38. 'pink',
  39. 'brown',
  40. 'purple',
  41. 'brown',
  42. 'white',
  43. 'black',
  44. 'orange',
  45. ]
  46. const nouns = [
  47. 'table',
  48. 'chair',
  49. 'house',
  50. 'bbq',
  51. 'desk',
  52. 'car',
  53. 'pony',
  54. 'cookie',
  55. 'sandwich',
  56. 'burger',
  57. 'pizza',
  58. 'mouse',
  59. 'keyboard',
  60. ]
  61. const data = []
  62. for (let i = 0; i < count; i++)
  63. data.push({
  64. id: ID++,
  65. label:
  66. adjectives[_random(adjectives.length)] +
  67. ' ' +
  68. colours[_random(colours.length)] +
  69. ' ' +
  70. nouns[_random(nouns.length)],
  71. })
  72. return data
  73. }