Skip to content

Instantly share code, notes, and snippets.

@aaronthorp
Created January 16, 2014 01:48
Show Gist options
  • Save aaronthorp/8448391 to your computer and use it in GitHub Desktop.
Save aaronthorp/8448391 to your computer and use it in GitHub Desktop.
Convert Single value array to non-Array values in Array of Objects
FixArrays = function(arrayObject) {
var temp = {};
_.each(arrayObject , function(value, key, list) {
if (value instanceof Array)
if (value.length === 1)
temp[key] = value[0];
else
temp[key] = value;
else
temp[key] = value;
});
return temp;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment