UNPKG

741 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6var repeat = exports.repeat = function repeat(str, times) {
7 return new Array(times + 1).join(str);
8};
9
10var pad = exports.pad = function pad(num, maxLength) {
11 return repeat("0", maxLength - num.toString().length) + num;
12};
13
14var formatTime = exports.formatTime = function formatTime(time) {
15 return pad(time.getHours(), 2) + ":" + pad(time.getMinutes(), 2) + ":" + pad(time.getSeconds(), 2) + "." + pad(time.getMilliseconds(), 3);
16};
17
18// Use performance API if it's available in order to get better precision
19var timer = exports.timer = typeof performance !== "undefined" && performance !== null && typeof performance.now === "function" ? performance : Date;
\No newline at end of file