@toreda/time
Version:
Simple, small footprint library for common time operations and converting between units of time.
14 lines (13 loc) • 524 B
TypeScript
import type { TimeUnit } from '../unit';
/**
* Type guard: returns `true` only when `unit` is a canonical `TimeUnit`.
* Aliases (e.g. `'day'`, `'sec'`) are rejected — use `timeUnitFromAlias`
* to resolve aliases to canonical values first.
*
* @param unit Value to validate as a canonical time unit.
* @returns true - `unit` is a canonical `TimeUnit`.
* false - `unit` is not a canonical `TimeUnit`.
*
* @category Time Units
*/
export declare function timeUnitSupported(unit?: unknown): unit is TimeUnit;