f95e9a7d37
- This will need to be separated and configured accordingly - This was a quick spin up, using jest as a library to implement some coverage - Further things to be refined - mocks, more coverage, better configuration, clean up methods, improve env vars
18 lines
434 B
TypeScript
18 lines
434 B
TypeScript
// timer actions
|
|
// Store current time as `start`
|
|
export const now = (eventName = null) => {
|
|
if (eventName) {
|
|
console.log(`Started ${eventName}..`);
|
|
}
|
|
return new Date().getTime();
|
|
}
|
|
|
|
//takes arg of start time
|
|
export const elapsed = (beginning: number, log = false) => {
|
|
const duration = new Date().getTime() - beginning;
|
|
if (log) {
|
|
console.log(`${duration / 1000}s`);
|
|
}
|
|
return duration;
|
|
}
|