UNPKG

rambdax

Version:

Extended version of Rambda - a lightweight, faster alternative to Ramda

11 lines (8 loc) 251 B
import { isArray } from './_internals/isArray.js' export function count(predicate, list){ if (arguments.length === 1){ return _list => count(predicate, _list) } if (!isArray(list)) return 0 return list.filter(x => predicate(x)).length }