- Add GETTING_STARTED.md with quick start guide and development modes - Add INSTALL.sh automated installation script - Add INSTALLATION_CHECKLIST.md, INSTALLATION_SUCCESS.md, and INSTALLATION_SUMMARY.md - Add QUICK_REFERENCE.md for common commands - Add SETUP_GUIDE.md with detailed setup instructions - Update README.md with improved project overview - Add did-wallet app dependencies and node_modules
19 lines
560 B
JavaScript
19 lines
560 B
JavaScript
// Port of lower_bound from https://en.cppreference.com/w/cpp/algorithm/lower_bound
|
|
// Used to compute insertion index to keep queue sorted after insertion
|
|
export default function lowerBound(array, value, comparator) {
|
|
let first = 0;
|
|
let count = array.length;
|
|
while (count > 0) {
|
|
const step = Math.trunc(count / 2);
|
|
let it = first + step;
|
|
if (comparator(array[it], value) <= 0) {
|
|
first = ++it;
|
|
count -= step + 1;
|
|
}
|
|
else {
|
|
count = step;
|
|
}
|
|
}
|
|
return first;
|
|
}
|