* Remove objects from array with deprecated: true. * * @param arr An array. * @returns The array without objects that have deprecated: true.
( arr: T[] )
| 9 | * @returns The array without objects that have deprecated: true. |
| 10 | */ |
| 11 | function filterDeprecated<T extends { deprecated: boolean | null }>( |
| 12 | arr: T[] |
| 13 | ): T[] { |
| 14 | return arr.filter(i => !i.deprecated); |
| 15 | } |
| 16 | |
| 17 | function getRandomElement<T>(arr: T[]): T { |
| 18 | const id: number = Math.floor(Math.random() * arr.length); |
no outgoing calls
no test coverage detected