meows
Version:
A kittybin of tools.
33 lines (32 loc) • 1.23 kB
TypeScript
/**
* Convert an integer from 1 to 12 to a month.
* @example
* numberToMonth(1) // => January
* numberToMonth(12) // => December
*/
export declare function numberToMonth(int: number): string;
/** A utility to store multiple timestamps for performance timing.
* @example
* const timer = new Timer()
* timer.start('fetch starts')
* timer.next('fetch resolved')
* timer.end('awaiting done')
*/
export declare class Timer {
/** The full state of the Timer object. */
_log: any[];
/** A list of Unix timestamps. */
_times: () => any[];
/** Add a midpoint to timer with optional label. */
next: (label?: string) => number;
/** Start timer with optional label. */
start: (label?: string) => number;
/** Add endpoint to timer with optional label. */
end: (label?: string) => number;
/** range :: () → [integer tF - t0] || NaN if fewer than 2 timestamps */
range: (arr?: any[]) => number;
/** delta :: () → [ integer list of velocities ] || [] if fewer than 2 timestamps */
delta: ([head, ...tail]?: any[]) => any;
/** Returns array of relative difference of time from start, with head as initial timestamp. */
relative: ([head, ...tail]?: any[]) => any;
}