UNPKG

@everwhen/temporal

Version:
40 lines (39 loc) 1.11 kB
/** * A series wraps a list of values that should be * treated with order, providing methods to navigate * and compare items within the series. */ export declare class Series<T> { #private; constructor(items: T[], toKey?: (item: T) => string | symbol); /** * Given two values in the series, returns the * value that occurs earlier in the series */ min(a: T, b: T): T; /** * Given two values in the series, returns the * value that occurs later in the series */ max(a: T, b: T): T; /** * Returns the first item from the series */ first(): T; /** * Returns the last item in the series */ last(): T; /** * Given an item in the series returns the next item * in the series or default if the given value is * the last item in the series */ next(current: T, defaultValue?: T): T; /** * Given an item in the series returns the previous item * in the series or default if the given value is * the first item in the series */ previous(current: T, defaultValue?: T): T; }