Skip to content

Instantly share code, notes, and snippets.

@sethvincent
Created May 12, 2015 19:02
Show Gist options
  • Save sethvincent/b6b34847e5707b0d772a to your computer and use it in GitHub Desktop.
Save sethvincent/b6b34847e5707b0d772a to your computer and use it in GitHub Desktop.
example of format function option
function accounts (opts) {
this.format = opts.format
}
accounts.prototype.create = function (req, res, cb) {
var self = this
parseBody(req, function (err, body) {
var body = self.format(body)
cb(err, body)
})
}
var a = new accounts({
format: function (body) {
body.cool = 'yep'
return body
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment