Instantly share code, notes, and snippets.

What would you like to do?
(function (userProfiles, $) {
//Store the value in our JSON object
function updateProperty (key, value) {
userProfiles.Current[key] = value;
//This method iterates through the nested ugly JSON object array to get what we need (IE9+ or you will need to refactor the array.some functionality)
function getPropertyByKey (results, key, keyName, defaultValue) {
if (typeof results[key] !== 'undefined') {
return results[key];
} else {
results.UserProfileProperties.results.some(function(item, i) {
if (item[keyName] === key) {
defaultValue = item.Value;
return true;
} else {
return false;
return defaultValue;
})(MyCompany.UserProfiles = MyCompany.UserProfiles || {}, jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment