react-epoch-picker
Version:
A React UI component for choosing an date epoch, starting zoomed out at millenniums and going down through the centuries, decades and years.
19 lines (17 loc) • 386 B
JavaScript
/**
* invokes a callback function x times
*
* @param {function} callback
* @param {number} total
*/
const repeat = (callback, total) => {
let arr = [];
for (let i = 0; i < total; i++) {
const returnValue = callback(i, total);
if (returnValue) {
arr.push(returnValue);
}
}
return arr;
};
export default repeat;