fix: send social link value when empty string is supplied (#36)

* fix: send social link value when empty string is supplied

* refactor: add clarity
This commit is contained in:
Adam Butterworth
2019-05-13 14:37:13 -06:00
committed by GitHub
parent 24819bc5df
commit ab62699148

View File

@@ -63,9 +63,10 @@ function packAccountCommitData(commitData) {
const packedData = commitData;
SOCIAL_PLATFORMS.forEach(({ id, key }) => {
if (commitData[key]) {
packedData.social_links = [{ platform: id, social_link: commitData[key] }];
}
// Skip missing values. Empty strings are valid values and should be preserved.
if (commitData[key] === undefined) return;
packedData.social_links = [{ platform: id, social_link: commitData[key] }];
delete packedData[key];
});