Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
onx2 committed Aug 22, 2024
1 parent f63cdfb commit e3b5753
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/core/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,16 @@ export const computeTotalSize = (cache: Cache): number => {
};

/**
* @internal
* Finds the index of an item in the cache whose computed offset is closest to the specified offset.
*
* The search starts from the given initial index `i` and adjusts the search range based on whether
* the offset at `i` is less than or equal to the target offset. If a match is found, the index of
* the item is returned; otherwise, the function returns -1 if the item is not found.
*
* @param {Cache} cache - The cache object containing the data.
* @param {number} offset - The target offset to search for within the cache.
* @param {number} i - The initial index to start searching from.
* @returns {number} - The index of the item closest to the offset, or -1 if not found.
*/
export const findIndex = (cache: Cache, offset: number, i: number): number => {
let low = 0;
Expand Down

0 comments on commit e3b5753

Please sign in to comment.