UNPKG

@toreda/time

Version:

Simple, small footprint library for common time operations and converting between units of time.

19 lines (18 loc) 583 B
/** * Internal helper providing a callable, mutable value with a `reset` method. * Replaces the small surface of `@toreda/strong-types` (`floatMake`, * `uIntMake`, etc.) actually used in this codebase. * * Usage: * const interval = mutable(0); * interval(); // read * interval(5); // write * interval.reset(); // restore initial * * Not exported from the package root; intended for internal use only. */ export interface Mutable<T> { (value?: T | null): T; reset: () => void; } export declare function mutable<T>(initial: T): Mutable<T>;