SHARE
TWEET

Untitled

a guest Mar 20th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const generateNodes = ({
  2.   numberOfColumns,
  3.   numberOfRows,
  4. }) => (
  5.   Array(
  6.     numberOfColumns
  7.     * numberOfRows
  8.   )
  9.   .fill()
  10.   .map((
  11.     item,
  12.     index,
  13.   ) => ({
  14.     colorId: (
  15.       Math
  16.       .floor(
  17.         Math.random() * 3
  18.       )
  19.     ),
  20.     id: index,
  21.     x: index % numberOfColumns,
  22.     y: Math.floor(index / numberOfColumns),
  23.   }))
  24. )
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top