alldayalone / summer

This repository is a sandbox for your first open source contribution.
MIT License
0 stars 5 forks source link

add times function #10

Open shevv920 opened 4 years ago

shevv920 commented 4 years ago

times receives as arguments the function to execute n times and a number of iterations, and returns an array of the results. Very useful when creating dynamic test data.

const randomBool = () => Math.random() > 0.5;

const result = times(randomBool, 5);
// result: [true, false, false, true, false]
alldayalone commented 4 years ago

taken by @AlekseyGoremykin