steevehook
8/23/2018 - 2:29 PM

Array data generator

Array data generator

function* genPeople(numberOfPeople) {
    let i = 0;
    while (i++ < numberOfPeople) {
        yield {
            name: `John ${i}`,
            surname: `Doe ${i}`
        };
    }
}

Array.from(genPeople(20));