Skip to content

Commit

Permalink
add jsdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
myandrienko committed Dec 18, 2024
1 parent cf39e41 commit 41275d9
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,15 +318,25 @@ export const findIndexInSortedArray = <T, L>({
needle: T;
sortedArray: readonly T[];
/**
* In array of objects (like messages), pick a specific
* property to compare needle value to.
* In an array of objects (like messages), pick a unique property identifying
* an element. It will be used to find a direct match for the needle element
* in case compare values are not unique.
*
* @example
* ```ts
* selectValueToCompare: (message) => message.created_at.getTime()
* selectKey: (message) => message.id
* ```
*/
selectKey?: (arrayElement: T) => string;
/**
* In an array of objects (like messages), pick a specific
* property to compare the needle value to.
*
* @example
* ```ts
* selectValueToCompare: (message) => message.created_at.getTime()
* ```
*/
selectValueToCompare?: (arrayElement: T) => L | T;
/**
* @default ascending
Expand Down

0 comments on commit 41275d9

Please sign in to comment.