Created
May 12, 2015 19:02
-
-
Save sethvincent/b6b34847e5707b0d772a to your computer and use it in GitHub Desktop.
example of format function option
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
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