snapmetrics
Version:
Lightweight library for tracking real-time metrics and events with rolling statistics over configurable time windows.
13 lines (12 loc) • 577 B
TypeScript
/**
* Converts a time window string (e.g., "1m") into milliseconds.
* @param window Time window string
* @returns Milliseconds equivalent
*/
export declare const parseTimeWindow: (window: string) => number;
/**
* Swaps the first and second levels of keys in a nested object.
* @param obj Object with nested key structure to transform
* @returns Object with first and second level keys swapped
*/
export declare const swapLevels: <K1 extends string | number | symbol, K2 extends string | number | symbol, V>(obj: Record<K1, Record<K2, V>>) => Record<K2, Record<K1, V>>;