@toreda/time
Version:
Simple, small footprint library for common time operations and converting between units of time.
14 lines (13 loc) • 536 B
TypeScript
import type { TimeUnit } from '../../unit';
/**
* Resolve a loose alias string (e.g. `'day'`, `'sec'`, `'minutes'`) to
* its canonical `TimeUnit` value. Intended for user-facing functions
* that accept alias input; returns `null` when the value is not a
* recognized alias or canonical unit.
*
* @param value Candidate alias or canonical unit string.
* @returns Canonical `TimeUnit` when recognized, otherwise `null`.
*
* @category Time Units
*/
export declare function timeUnitFromAlias(value?: unknown): TimeUnit | null;