Created
January 16, 2014 01:48
-
-
Save aaronthorp/8448391 to your computer and use it in GitHub Desktop.
Convert Single value array to non-Array values in Array of Objects
This file contains hidden or 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
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