Skip to content

assertcheck v1.0.0


assertcheck / assert / count

Function: count() ​

ts
function count<T>(
   arr, 
   predicate, 
   n, 
   opts?): void;

Defined in: src/assert.ts:972

Asserts that exactly n elements satisfy the predicate — Ruby count { }.

Type Parameters ​

Type Parameter
T

Parameters ​

ParameterType
arrT[]
predicate(v) => boolean
nnumber
opts?Opts

Returns ​

void

Example ​

ts
`assert.count(transactions, t => t.amount > 1000, 3, "expected 3 large transactions")`

Released under the Apache 2.0 License. Built by Vagabond Studio — senior-only for growing companies.