Skip to content

Commit

Permalink
Avoid duplicating objectifySerialized utility JS function
Browse files Browse the repository at this point in the history
  • Loading branch information
apbendi committed Sep 4, 2020
1 parent b3e55d1 commit 3b05210
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 24 deletions.
13 changes: 13 additions & 0 deletions app/assets/v2/js/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,3 +469,16 @@ function applyCartMenuStyles() {
}
}
}

// Turn form data pulled form page into a JS object
function objectifySerialized(data) {
let objectData = {};

for (let i = 0; i < data.length; i++) {
const item = data[i];

objectData[item.name] = item.value;
}

return objectData;
}
12 changes: 0 additions & 12 deletions app/assets/v2/js/grants/funding.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,15 +255,3 @@ function toggleSideCart() {
$('#funding-card').toggleClass('d-none');
$('#funding-card').toggleClass('d-lg-block');
}

function objectifySerialized(data) {
let objectData = {};

for (let i = 0; i < data.length; i++) {
const item = data[i];

objectData[item.name] = item.value;
}

return objectData;
}
12 changes: 0 additions & 12 deletions app/assets/v2/js/pages/profile-trust.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,3 @@ let show_brightid_connect_modal = function(brightid_uuid) {
$(content).appendTo('body');
$('#verify_brightid_modal').bootstrapModal('show');
};

function objectifySerialized(data) {
let objectData = {};

for (let i = 0; i < data.length; i++) {
const item = data[i];

objectData[item.name] = item.value;
}

return objectData;
}

0 comments on commit 3b05210

Please sign in to comment.