/** * Misc Helpers */ /** * @param {T[]} arr - array to search * @param {T} item - item to search for * @returns boolean - true if `item` is in `arr` */ export declare function contains(arr: T[], item: T): boolean; /** * Returns Index of first match to `predicate` in `arr` * @param arr Array to search * @param predicate Function that returns true for a match */ export declare function findIndex(arr: T[], predicate: (el: T, index: number) => boolean): number; /** * Returns first match to `predicate` in `arr` * @param arr Array to search * @param predicate Function that returns true for a match */ export declare function find(arr: T[], predicate: (el: T, index: number) => boolean): T; /** * Formats and shortens a url for ui * @param {string} url * @param {number} maxLength - max length of shortened url * @returns string */ export declare function resourceUrlFormatter(url: string, maxLength: number): string; /** * Helper to add a precision to `Math.round`. * * _defaults to 2 decimals_ * @param {number} num - number to round * @param {number} [decimals=2] - decimal precision to round to */ export declare function roundNumber(num: number, decimals?: number): number; /** * * Checks if `status` code is `>= lowerBound` and `<= upperBound` * @param {number} status HTTP status code * @param {number} lowerBound inclusive lower bound * @param {number} upperBound inclusive upper bound */ export declare function isInStatusCodeRange(status: number, lowerBound: number, upperBound: number): boolean; /** * Converts a seed string to a CSS class by stripping out invalid characters * @param {string} seed string to base the CSS class off */ export declare function toCssClass(seed: string): string; /** * Conditionally pluralizes (adding 's') `word` based on `count` * @param {string} word word to pluralize * @param {number} count counter to deceide weather or not `word` should be pluralized */ export declare function pluralize(word: string, count: number): string; /** * Check if event is `tab` + `shift` key, to move to previous input element * @param {KeyboardEvent} evt Keyboard event */ export declare function isTabUp(evt: KeyboardEvent): boolean; /** * Check if event is only `tab` key, to move to next input element * @param {KeyboardEvent} evt Keyboard event */ export declare function isTabDown(evt: KeyboardEvent): boolean;