/** * @module Utils */ /** * Helper function to resolve promise after ms. * * @function * @param {number} ms Number of milliseconds to delay * @returns {Promise} A promise that resovles after ms milliseconds */ export declare const delay: (ms: number) => Promise; /** * Helper function to provide promises from getters/setters. * Used to lazily initialize values when the getter returns undefined. * * @function * @param {() => any} getter A function to return the value * @param {() => Promise} updater A function that sets a value, that can be later retrieved from the getter * @returns {Promise} A promise that returns the value that was set from the updater parameter */ export declare function lazy(getter: () => T | undefined, updater: () => Promise): Promise; /** * Helper function to convert an array, to key/value pairs. * ie. ['foo', 'bar', 'meow', 'rawr'] => {foo: 'bar', meow: 'rawr'} * * @function * @param {Array<{ toString(): string }>} array The array to convert * @returns {object} The object that was converted */ export declare const arrayToKvp: (array: T[]) => Record; /** * Helper function to parse time strings (Mainly on the profile pages) into seconds.
* For example: 2m ago => 120 * * @function * @param {string} text The string of text to parse. ie 5s ago * @throws {ChatExchangeError} If the string doesn't match the format suffix (s/m/h/d/y). * @returns {number} The number */ export declare const parseAgoString: (value: T) => number;