data-stopwatch
Measure the elapsed time in your code between two moments
Installation
npm install --save data-stopwatch
Usage
; // Code to measure // Returns a tuple [number, number] that means [seconds, nanoseconds]stopwatch.pause.read;// Returns a single number as millisecondsstopwatch.pause.readMilliseconds;// Returns a string representing an approximation of the elapsed time readable to humansstopwatch.pause.readHumanized; // Any stopwatch can be paused and resumed as many times as neededstopwatch.resume; // Also, it might be useful to mark named moments in the stopwatch stopwatch.mark 'name1' ; // Also possible to create marks that only count time after a previous markstopwatch.mark 'name2', 'name1' ; // Their times can be read with the same methods as before but with the mark name as argumentstopwatch.readHumanized 'name2' ;