mirror of
https://github.com/zulip/zulip.git
synced 2025-11-13 10:26:28 +00:00
util: Remove unused code for lower_bound.
We currently do not need support for passing first and last index to the lower_bound function, so we just remove it.
This commit is contained in:
committed by
Tim Abbott
parent
782fca79c4
commit
cfc2d7c842
@@ -51,7 +51,6 @@ run_test("lower_bound", () => {
|
||||
assert.equal(util.lower_bound(arr, 15), 1);
|
||||
assert.equal(util.lower_bound(arr, 50), 4);
|
||||
assert.equal(util.lower_bound(arr, 55), 5);
|
||||
assert.equal(util.lower_bound(arr, 2, 4, 31), 3);
|
||||
|
||||
arr = [{x: 10}, {x: 20}, {x: 30}];
|
||||
|
||||
|
||||
@@ -15,24 +15,9 @@ export function random_int(min, max) {
|
||||
// for some i and false otherwise.
|
||||
//
|
||||
// Usage: lower_bound(array, value, [less])
|
||||
// lower_bound(array, first, last, value, [less])
|
||||
export function lower_bound(array, arg1, arg2, arg3, arg4) {
|
||||
let first;
|
||||
let last;
|
||||
let value;
|
||||
let less;
|
||||
if (arg3 === undefined) {
|
||||
first = 0;
|
||||
last = array.length;
|
||||
value = arg1;
|
||||
less = arg2;
|
||||
} else {
|
||||
first = arg1;
|
||||
last = arg2;
|
||||
value = arg3;
|
||||
less = arg4;
|
||||
}
|
||||
|
||||
export function lower_bound(array, value, less) {
|
||||
let first = 0;
|
||||
const last = array.length;
|
||||
if (less === undefined) {
|
||||
less = function (a, b) {
|
||||
return a < b;
|
||||
|
||||
Reference in New Issue
Block a user