Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

util: Remove unused code for lower_bound.

Priyank Patelcfc2d7c842f1
diff --git a/frontend_tests/node_tests/util.js b/frontend_tests/node_tests/util.js
index 9603c47bcb7..bcba3d9b7f6 100644
--- a/frontend_tests/node_tests/util.js
+++ b/frontend_tests/node_tests/util.js
@@ -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}];
diff --git a/static/js/util.js b/static/js/util.js
index 57c02f6e2d5..f74a1fe9155 100644
--- a/static/js/util.js
+++ b/static/js/util.js
@@ -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;