helper.js 507 B

1234567891011121314151617181920
  1. module.exports = {
  2. sanititizeTotal : (total) => {
  3. let totalIterations;
  4. if (!total || typeof(total) != 'number') {
  5. totalIterations = 1;
  6. } else if(total < 501 && total > 0) {
  7. totalIterations = total;
  8. } else if (total > 500) {
  9. totalIterations = 500;
  10. } else {
  11. totalIterations = 1;
  12. }
  13. return totalIterations;
  14. },
  15. randomizeNum : () => {
  16. return Math.floor(Math.random() * 10000) + 1
  17. }
  18. }