This package has been deprecated

Author message:

Deprecated. Use @malijs/transform

mali-transform

0.1.1 • Public • Published

mali-transform

Mali response payload transform middleware

npm version build status

API

mali-transform ⇒ function

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

Returns: function - the middleware function

Param Type Description
fn String The name of the function property to check against in the response object

Example

const xform = require('mali-transform')

function handler(ctx) {
  const obj = {
    email: 'bob@gmail.com',
    password: 'mysecret'
  }

  obj.xform = function() {
    return {
      email: this.email
    }
  }

  ctx.res = obj // password will not be in the payload to client
}

app.use('fn', xform('xform'), handler)

License

Apache-2.0

Package Sidebar

Install

npm i mali-transform

Weekly Downloads

2

Version

0.1.1

License

Apache-2.0

Last publish

Collaborators

  • bojand