superagent-serializer

0.2.2 • Public • Published

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

  • upper : foo_bar -> FOO BAR
  • lower : fooBar -> foo bar
  • snake : Foo bar! -> foo_bar
  • pascal : foo.bar -> FooBar
  • camel : foo, bar -> fooBar
  • kebab : Foo? Bar. -> foo-bar
  • constant : Foo-Bar -> FOO_BAR
  • title : foo v. bar -> Foo v. Bar
  • capital : foo_v_bar -> Foo V Bar

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.2
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.2.2
    1
  • 0.2.1
    3
  • 0.1.1
    0

Package Sidebar

Install

npm i superagent-serializer

Weekly Downloads

4

Version

0.2.2

License

MIT

Last publish

Collaborators

  • deanbot
  • zzarcon