Counts the number of elements that satisfy a predicate.
const words = ['Ada', 'Grace', 'Linus'] as const;const longWords = Arr.count(words, (word) => word.length > 4);const withCurried = Arr.count<string>((word) => word.includes('a'))(words);assert(longWords === 2);assert(withCurried === 2); Copy
const words = ['Ada', 'Grace', 'Linus'] as const;const longWords = Arr.count(words, (word) => word.length > 4);const withCurried = Arr.count<string>((word) => word.includes('a'))(words);assert(longWords === 2);assert(withCurried === 2);
Counts the number of elements that satisfy a predicate.