Created
January 14, 2015 21:24
-
-
Save tmcw/f31327e5d34768d28198 to your computer and use it in GitHub Desktop.
Gist from mistakes.io
This file contains 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
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