GT2/GT2-iOS/node_modules/redux-logger/lib/helpers.js

19 lines
741 B
JavaScript
Raw Normal View History

2018-02-12 17:26:06 +00:00
"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;