Skip to content

assertcheck v1.0.0


assertcheck / assert / sumBy

Function: sumBy()

ts
function sumBy<T>(
   arr, 
   iteratee, 
   expected, 
   opts?): void;

Defined in: src/assert.ts:1285

Asserts that _.sumBy(arr, iteratee) equals expected — Ruby arr.sum.

Type Parameters

Type Parameter
T

Parameters

ParameterType
arrT[]
iterateestring | ((value) => number)
expectednumber
opts?Opts

Returns

void

Example

ts
`assert.sumBy(lineItems, "totalCents", invoiceTotal, "line items must match invoice")`

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