Mali middleware that automatically calls toObject on response
npm install @malijs/toobjecttoObject middleware. If the response object has a toObject function it's executedUNARY and REQUEST_STREAM call types.Example
``js
const toObject = require('@malijs/toobject')
function handler(ctx) {
const obj = {
email: 'bob@gmail.com',
password: 'mysecret'
}
obj.toObject = function() {
return {
email: this.email
}
}
ctx.res = obj // password will not be in the payload to client
}
app.use('fn', toObject(), handler)
``