Skip to content

Commit

Permalink
dashboard: remove our intoObject and use Object.fromEntries
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan committed Jul 17, 2023
1 parent 86e4009 commit a30ed2b
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions dashboard/assets/scripts/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,23 +122,12 @@ function regExpEscape(s) {
return escaped;
}

/**
* [[1, 2], [3, 4]] -> {1: 2, 3: 4}
*/
function intoObject(arr) {
const obj = {};
arr.forEach((e) => {
obj[e[0]] = e[1];
});
return obj;
}

function getQueryArgs() {
const pairs = location.search.replace("?", "").split("&");
if (pairs === "") {
return {};
}
return intoObject(pairs.map((e) => split(e, "=", 1)));
return Object.fromEntries(pairs.map((e) => split(e, "=", 1)));
}

function addAnyChangeListener(elem, func) {
Expand Down

0 comments on commit a30ed2b

Please sign in to comment.