countBy
Array.countBy(target, predicate)
Counts the number of elements in the target array satisfy the provided predicate function.
Example
ts
import { Array } from "@monstermann/array";
const isEven = (n) => n % 2 === 0;
Array.countBy([1, 2, 3, 4, 5], isEven); // 2ts
import { Array } from "@monstermann/array";
const isEven = (n) => n % 2 === 0;
pipe([1, 2, 3, 4, 5], Array.countBy(isEven)); // 2