boo1ean / casual

Fake data generator for javascript
3.03k stars 154 forks source link

Add array of (fixes #29) #106

Closed lil5 closed 3 years ago

lil5 commented 3 years ago

This PR includes tests and typescript description.

Adds helper function array_of

var array_of = function(times, generator) {
    var result = [];

    for (var i = 0; i < times; ++i) {
        result.push(generator());
    }

    return result;
};

https://github.com/boo1ean/casual#generators-functions Under the generated functions header in the Readme, this function is used as example, I thought it would be better to have this helper function availible in casual.

boo1ean commented 3 years ago

Thank you!