UNPKG

@extra-array/count

Version:

Counts values which satisfy a test.

10 lines (9 loc) 166 B
'use strict'; function count(x, ft) { var a = 0, i = -1; for (var v of x) if (ft(v, ++i, x)) a++; return a; } module.exports = count;