Created
March 9, 2018 18:40
-
-
Save BenFausch/993f2db7f1b657db6f1165f616d3f40a to your computer and use it in GitHub Desktop.
user an array of key names to verify that they're in an object, add empty array with key 0 if false
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var checker = ['attain-location-address-1', 'attain-location-address-2', 'attain-location-city', 'attain-location-state', 'attain-location-zipcode'] | |
for (var i = 0; i < checker.length; i++) { | |
if (!result['custom_fields'].hasOwnProperty(checker[i])) { | |
result['custom_fields'][checker[i]] = []; | |
result['custom_fields'][checker[i]][0] = ''; | |
} | |
} | |
return result; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment