Skip to content

assertcheck v1.0.0


assertcheck / assert / mapsDistinct

Function: mapsDistinct()

ts
function mapsDistinct<T, U>(
   fn, 
   a, 
   b, 
   opts?): void;

Defined in: src/assert.ts:1855

Asserts that fn(a) and fn(b) produce different results. Useful to detect hash collisions or identity-collapse bugs.

Type Parameters

Type Parameter
T
U

Parameters

ParameterType
fn(v) => U
aT
bT
opts?Opts

Returns

void

Example

ts
`assert.mapsDistinct(hashFn, "user:1", "user:2", "hash collision")`

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