This package has been deprecated

Author message:

Deprecated. Use @malijs/toobject

mali-toobject

0.2.0 • Public • Published

mali-toobject

Mali toObject middleware. If the response object has a toObject function it's executed upon payload. Only applies for UNARY and REQUEST_STREAM call types.

Example

const toObject = require('mali-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)

Package Sidebar

Install

npm i mali-toobject

Weekly Downloads

1

Version

0.2.0

License

Apache-2.0

Last publish

Collaborators

  • bojand