Skip to content

Instantly share code, notes, and snippets.

@cbertelegni
Last active June 2, 2016 19:37
Show Gist options
  • Save cbertelegni/90e8be17168e91008fb62dc3eafe4212 to your computer and use it in GitHub Desktop.
Save cbertelegni/90e8be17168e91008fb62dc3eafe4212 to your computer and use it in GitHub Desktop.
/** fn push items on specific object
* _push to _obj
*/
function pushVarsObjs (_push, _obj){
for (var c in _push){
if ( typeof(_push[c]) == "object" ){
// check if is an Array
_obj[c] = _push[c].indexOf ? [] : {};
for (var k in _push[c] ){
_obj[c][k] = _push[c][k];
}
}else{
_obj[c] = _push[c];
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment