(array: T[], refernce: T)
| 46 | * Count the number of elements of the `array` that are equal to `reference`. |
| 47 | */ |
| 48 | export function count<T>(array: T[], refernce: T) { |
| 49 | let counter = 0; |
| 50 | for (const item of array) { |
| 51 | if (item === refernce) { |
| 52 | counter++; |
| 53 | } |
| 54 | } |
| 55 | return counter; |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * If an array is of length 1, just return the first element. Otherwise, return |
no outgoing calls
no test coverage detected
searching dependent graphs…