Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created January 14, 2015 21:24
Show Gist options
  • Save tmcw/f31327e5d34768d28198 to your computer and use it in GitHub Desktop.
Save tmcw/f31327e5d34768d28198 to your computer and use it in GitHub Desktop.
Gist from mistakes.io
var columns = {
a: 1,
b: 2
};
function pairs(o) {
return Object.keys(o).map(function(k) {
return [k, o[k]];
});
}
update = 'UPDATE ' + pairs(columns).map(function(c) {
return c[0] + '=?';
}).join(',');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment