UNPKG

calctimedvzl

Version:

Módulo para calculos simples e tempo

24 lines (19 loc) 466 B
class Calc { sum(...num) { return num.reduce((total, num) => total + num, 0); } sub(...num) { return num.reduce((total, num) => total - num); } mult(...num) { return num.reduce((total, num) => total * num); } div(...num) { return num.reduce((total, num) => total / num); } stop(ms) { const start = new Date().getTime(); while (new Date().getTime() - start < ms) {} } } module.exports = new Calc