rename cloned_file_collection to entry_collection

This commit is contained in:
2025-03-06 20:56:06 -05:00
parent aa6f8b6f8e
commit 17e89ef1c8

View File

@ -8,15 +8,15 @@ function wrap_result<T>(result: T, index: number): Wrap<T> {
return { result: result, index: index } return { result: result, index: index }
} }
export default function entry_search<T extends Entry>(cloned_file_collection: T[], file_name: string): Wrap<T> | undefined { export default function entry_search<T extends Entry>(entry_collection: T[], file_name: string): Wrap<T> | undefined {
let start = 0 let start = 0
let end = cloned_file_collection.length-1 let end = entry_collection.length-1
while (start<=end) { while (start<=end) {
const median = (start+end)>>1 const median = (start+end)>>1
const median_name = cloned_file_collection[median].name const median_name = entry_collection[median].name
if (median_name === file_name) { if (median_name === file_name) {
return wrap_result(cloned_file_collection[median], median) return wrap_result(entry_collection[median], median)
} else if (median_name<file_name) { } else if (median_name<file_name) {
start = median+1 start = median+1
} else { } else {