@naturalcycles/js-lib
Version:
Standard library for universal (browser + Node.js) javascript
26 lines (25 loc) • 656 B
TypeScript
import type { NumberOfMilliseconds, UnixTimestampMillis } from '../types.js';
/**
* using _ = blockTimer()
* // will log "took 1.234 sec" on dispose
*
* using _ = blockTimer('named')
* // will log "named took 1.234 sec" on dispose
*
* @experimental
*/
export declare function _blockTimer(name?: string): Disposable;
/**
* Returns time passed since `from` until `until` (default to Date.now())
*/
export declare function _since(from: UnixTimestampMillis, until?: UnixTimestampMillis): string;
/**
* Returns, e.g:
* 125 ms
* 1.125 sec
* 11 sec
* 1m12s
* 59m2s
* 1h3m12s
*/
export declare function _ms(millis: NumberOfMilliseconds): string;