export function findLast( array: readonly T[], predicate: (item: T, index: number, array: readonly T[]) => item is S ): S | undefined { for (let i = array.length - 1; i >= 0; i -= 1) { const item = array[i] if (predicate(item, i, array)) { return item } } return undefined } // Keep the following wrapper functions as it can be mangled and will result in smaller bundle size that using // the native Object.values and Object.entries directly export function objectValues(object: { [key: string]: T }) { return Object.values(object) } export function objectEntries(object: { [key: string]: T }): Array<[string, T]> { return Object.entries(object) }