Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 1x 67x 14x 13x 13x 1x 1x 14x 67x 3x 2x 2x 1x 1x 3x 67x 67x 67x 67x 67x 67x 67x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 67x 67x 67x 67x 67x 67x 67x 67x | export default function UtilsLib() { const _safeStringOperation = function<T>(input: T): string { if(typeof input === 'string') { return input; } else { throw new Error("String Value is Required"); } } const _safeDateOperation = function<T>(input: T): Date { if (input instanceof Date) { return new Date(input); } else { throw new Error(`Error processing date object:`); } } const _padValue = function(val: number) { let s = String(val); if(s.length === 1) { s = "0" + s; } return s; } const calculateElapsedRuntimeOfControlTests = function(testStart: Date, testEnd: Date) { const elapsedTimeInMS = testEnd.getTime() - testStart.getTime(), seconds = Math.floor(elapsedTimeInMS / 1000), minutes = Math.floor(seconds / 60), hours = Math.floor(minutes / 60), elapsedTimeMessage = `Elapsed time to run tests: ${hours} hours, ${minutes} minutes, ${seconds} seconds, ${elapsedTimeInMS} milliseconds`; return { elapsedTimeMessage, elapsedTimeInMS, hours, minutes, seconds } } return { safeStringOperation: _safeStringOperation, safeDateOperation: _safeDateOperation, padValue: _padValue, calculateElapsedRuntimeOfControlTests } } |