You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

superagent-serializer

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

superagent-serializer

Superagent plugin to serialize response data into different types

0.2.2
latest
Source
npm
Version published
Weekly downloads
3
200%
Maintainers
2
Weekly downloads
 
Created
Source

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

FAQs

Package last updated on 05 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts