Home

Awesome

npm version

superagent-serializer

Superagent plugin to convert server payload into different cases

superagent plugin that brings you the hability of convert your server payload into different cases

Installation

$ npm i superagent-serializer --save

Usage

Having the following response

{
  "first_name": "Hector",
  "last-name": "Zarco"
}
var request = require('superagent');
var serializer = require('superagent-serializer');

serializer(request, 'camel');

request.get('data.json').send().end(function(err, res) {
  console.log(res.firstName + ' ' + res.lastName);
});

This will convert the output into

{
  "firstName": "Zarco",
  "lastName": "Hector Zarco"
}

Cases