19 lines
741 B
JavaScript
19 lines
741 B
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
var repeat = exports.repeat = function repeat(str, times) {
|
|
return new Array(times + 1).join(str);
|
|
};
|
|
|
|
var pad = exports.pad = function pad(num, maxLength) {
|
|
return repeat("0", maxLength - num.toString().length) + num;
|
|
};
|
|
|
|
var formatTime = exports.formatTime = function formatTime(time) {
|
|
return pad(time.getHours(), 2) + ":" + pad(time.getMinutes(), 2) + ":" + pad(time.getSeconds(), 2) + "." + pad(time.getMilliseconds(), 3);
|
|
};
|
|
|
|
// Use performance API if it's available in order to get better precision
|
|
var timer = exports.timer = typeof performance !== "undefined" && performance !== null && typeof performance.now === "function" ? performance : Date; |