js: Simplify code using default parameters and destructuring.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2021-03-24 13:44:43 -07:00
committed by Tim Abbott
parent 4703256c91
commit 7656d44abc
25 changed files with 116 additions and 261 deletions

View File

@@ -334,11 +334,7 @@ export function send_message_success(local_id, message_id, locally_echoed) {
echo.reify_message_id(local_id, message_id);
}
export function send_message(request) {
if (request === undefined) {
request = create_message_object();
}
export function send_message(request = create_message_object()) {
if (request.type === "private") {
request.to = JSON.stringify(request.to);
} else {