vtils

Home > utils > sampleBy

sampleBy() function

Signature:

export declare function sampleBy<T extends Record<any, any>, X>(collection: T, iteratee: <K extends keyof T>(value: T[K], key: K) => X): X | undefined;

Parameters

Parameter Type Description
collection T  
iteratee <K extends keyof T>(value: T[K], key: K) => X  

Returns:

X | undefined