Skip to content

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

TypeScript
347 B
Raw Blame
/**
 * How many items of a list pass a test, without the intermediate array a
 * filter would build.
 *
 * @param items the list
 * @param passes the test
 * @returns the number of passing items
 */
export const countOf = <T>(items: readonly T[], passes: (item: T) => boolean) =>
  items.reduce((total, item) => total + (passes(item) ? 1 : 0), 0)