Skip to content

assertcheck v1.0.0


assertcheck / assert / pure

Function: pure() ​

ts
function pure<TArgs, TReturn>(
   fn, 
   args, 
   opts?): void;

Defined in: src/assert.ts:1774

Asserts that calling fn twice with the same arguments produces identical results (referential transparency / pure function).

Type Parameters ​

Type Parameter
TArgs extends unknown[]
TReturn

Parameters ​

ParameterType
fn(...args) => TReturn
argsTArgs
opts?Opts

Returns ​

void

Example ​

ts
`assert.pure(calculateTax, [order])`

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