(array: Array<T>, predicate: (value: T, index: number, obj: T[]) => boolean)
| 409 | |
| 410 | // https://stackoverflow.com/questions/40929260/find-last-index-of-element-inside-array-by-certain-condition |
| 411 | export function findLastIndex<T>(array: Array<T>, predicate: (value: T, index: number, obj: T[]) => boolean): number { |
| 412 | let l = array.length; |
| 413 | while (l--) { |
| 414 | if (predicate(array[l], l, array)) return l; |
| 415 | } |
| 416 | return -1; |
| 417 | } |
| 418 | |
| 419 | // JSON.stringify version that can serialize otherwise unsupported types (bigint and Uint8Array) |
| 420 | export const extendedStringify = (obj: any, spaces?: number): string => JSON.stringify( |
no outgoing calls
no test coverage detected