UNPKG

@exadel/esl

Version:

Exadel Smart Library (ESL) is the lightweight custom elements library that provide a set of super-flexible components

34 lines (33 loc) 1.05 kB
/** * Parses time string * Less strict than CSS spec, allows empty string, numbers without units, ending dot, hours, minutes etc. * @example * `.3s`, `4.5s`, `1000ms`, `700`, `1h20m30s`, `2h`, `5m`, `25m1s`, `2h10s` * @returns number - time in milliseconds */ export declare function parseTime(timeStr: number | string): number; /** * Restrictive time parser according to [CSS style](https://developer.mozilla.org/en-US/docs/Web/CSS/time) spec. * @see {@link parseTime} */ export declare const parseCSSTime: (timeStr: string) => number; /** * Parses string of times ([CSS style](https://developer.mozilla.org/en-US/docs/Web/CSS/time)) * @example * `.3s`, `4.5s,1000ms`, `1s, 5s` * @returns number[] - array of times in milliseconds */ export declare function parseCSSTimeSet(timeStr: string): number[]; /** * Converts time value to seconds * @example * ``` * null => 0 * '3' => 3 * `.3s` => 0 * `4.5s` => 4 * `1000ms` => 1 * `2m3s` => 123 * ``` */ export declare const parseTimeSeconds: (value: number | string | null) => number;