Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
at main 529 B view raw
1// create a function that will take in a number of times to be run and a function that will produce an entry/entity 2export const makeEntries = (amount, makeEntry) => { 3 // create array of entries to be outputted 4 const entries = []; 5 // iterate from 0 up to the amount inputted 6 for (let i = 0; i < amount; i += 1) { 7 // each iteration, create an entry and pass it the current index & push it into output array 8 const entry = makeEntry(i); 9 entries.push(entry); 10 } 11 // return array of entries 12 return entries; 13};